Wie man eine CMake Option () an der Kommandozeile einstellt

Erstellte ich ein CMakeLists.txt enthält die folgenden

project(P4V)
cmake_minimum_required(VERSION 2.6)

option(BUILD_STATIC_LIBS "Build the static library" ON)
option(BUILD_SHARED_LIBS "Build the shared library" ON)
option(BUILD_TESTS "Build test programs" OFF)

include_directories(${CMAKE_SOURCE_DIR}/include)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_BUILD_TYPE Release)

add_subdirectory(src)
if(BUILD_TESTS)
    add_subdirectory(tests)
endif(BUILD_TESTS)

Standardmäßig BUILD_TESTS DEAKTIVIERT ist, wie kann ich es einschalten ohne CMake-GUI, aber mit cmake Befehl selbst?
Ich habe Folgendes versucht, aber es funktioniert nicht

cmake .. -G %1 -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_TESTS=ON
Kommentar zu dem Problem
Liste Ihre Fahnen vor .. - argument. Kommentarautor: arrowd
Mögliche Duplikate von stackoverflow.com/questions/5998186/... Kommentarautor: dharman
Als Antwort auf die 5998186 Punkte heraus, es ist 'cmake MyProjectFolder -DMyOption=' Kommentarautor: Langley
Haben Sie entfernt CMakeCache.txt bevor cmake wieder? Kommentarautor: Henry Hu
Mögliche Duplikate von Zusätzliche Kommandozeilen-Optionen für CMake Kommentarautor: jww

InformationsquelleAutor der Frage Denilson Amorim | 2013-08-26

Schreibe einen Kommentar