Le 21/06/2019 à 15:19, David Aldrich a écrit :
I now want to support separate target directories: build/debug and build/release.  I've shown my CMakeLists.txt below. So far I've just added an attempt to support build/debug:

if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
     message("debug mode")
     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/debug)
endif (CMAKE_BUILD_TYPE EQUAL "DEBUG")


Do never test CMAKE_BUILD_TYPE in CMakeLists.txt files, it is ignored in multiple generators (e.g. Visual Studio).

Just use the appropriate variables that contain suffixes regarding the configuration.

e.g

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/release)

See [0] for a list with _<CONFIG> variables.

[0]: https://cmake.org/cmake/help/v3.15/manual/cmake-variables.7.html

HTH

--
David
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to