3,973 questions
How to know the build type in CMakeLists.txt if it's Debug, Release or RelWithDebInfo?
Manda Rajo
141
Reputation points
How to know the build type (Debug, Release, MinSizeRel or RelWithDebInfo) in CMakeLists.txt. Googling my question seems difficult, as it's difficult to learn CMake online.
# Bullet - Set USE_BULLET_LIBS to ON to use Bullet .lib files,
# but set it to OFF to compile Bullet from its source code,
message("CMAKE_BUILD_TYPE = '${CMAKE_BUILD_TYPE}'") # <---- Why is it's empty ''?
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message("-- Bullet: Debug build")
set(USE_BULLET_LIBS ON)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
message("-- Bullet: Release build")
set(USE_BULLET_LIBS ON)
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
message("-- Bullet: Minimum size release build")
set(USE_BULLET_LIBS OFF)
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
message("-- Bullet: Release build with debug information")
set(USE_BULLET_LIBS OFF)
else()
message("-- Bullet: Unknown build type") # <---- This is the result, why?
endif()
To know my goal then please read and answer my other question:
https://learn.microsoft.com/en-us/answers/questions/1251388/how-to-use-target-link-libraries()-with-relwithdeb
Developer technologies | C++
Sign in to answer