Hi,

By default I would like to set CMAKE_BUILD_TYPE=Release (inside
CMakeLists.txt) if the user has not defined CMAKE_BUILD_TYPE himself (e.g.
as command-line option: cmake . -DCMAKE_BUILD_TYPE=Debug). Is there a best
practice how to do this in CMake? I have been searching the web to see how
other people achieved this and I found that many people use code like this:

if(NOT CMAKE_BUILD_TYPE)
        set(CMAKE_BUILD_TYPE "Release" CACHE STRING
        "Choose the type of build, options are: None Debug Release
RelWithDebInfo MinSizeRel."
        FORCE)
endif()

I used this code myself in one of my projects but I recently discovered
that this code causes issues when compiling with clang-cl on Windows.

Greetings,
Kim
-- 

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