2012-06-28 12 views

回答

10

docs

配置參數指定構建配置的列表,以及安裝的規則適用(調試,發佈等)。

因此,例如,請考慮以下CMakeListst.txt:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR) 
project(Test) 
add_executable(MyTest main.cc) 
install(TARGETS MyTest DESTINATION bin CONFIGURATIONS Release) 

這意味着

cmake --build . --target install --config Release 

將放置在${CMAKE_INSTALL_PREFIX}/bin可執行MyTest(或MyTest.exe),並

cmake --build . --target install --config Debug 

不會安裝任何東西。

+0

不幸的是,在CMake 3.7.2中,CONFIGURATIONS選項不起任​​何作用。安裝將很樂意安裝任何東西,無論配置:( – Robert