diff options
author | Nik Reist <zeroability@tutanota.com> | 2020-09-29 02:40:54 +0300 |
---|---|---|
committer | Nik Reist <zeroability@tutanota.com> | 2020-10-15 18:11:56 +0300 |
commit | 954dbc92da1c28aa4ba669394022e6f15d014d21 (patch) | |
tree | cf500932dc76a57d01a78de1166cb3c31812e953 /CMakeLists.txt | |
parent | caaf516ea50096e10476e76ad20ae2ef8505304b (diff) |
FIX(cmake): Revise if condition for Release build type
This satisfies the need to set the Release build type for generators that recognize it and simplifies the output for the build type in the cli.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 81866d409..b8954a822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,35 +53,13 @@ option(plugins "Build plugins." ON) option(debug-dependency-search "Prints extended information during the search for the needed dependencies" OFF) -# We support the "Debug" and "Release" configurations. -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" - "Release" -) - -get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(IS_MULTI_CONFIG) - set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) - - set(BUILD_STR "<multi-config>") -else() - # We set the CMake configuration to "Release", in case it's not set. - if(NOT CMAKE_BUILD_TYPE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release") - - set(BUILD_STR "Release") - elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - add_definitions( - "-DDEBUG" - "-DSNAPSHOT_BUILD" - ) - - set(BUILD_STR "Debug") - elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release") - set(BUILD_STR "Release") - else() - message(FATAL_ERROR "Unsupported build type! Please choose either \"Debug\" or \"Release\".") - endif() +if(NOT CMAKE_BUILD_TYPE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release") +elseif(CMAKE_BUILD_TYPE EQUAL "Debug") + add_definitions( + "-DDEBUG" + "-DSNAPSHOT_BUILD" + ) endif() include(compiler) @@ -111,7 +89,11 @@ endif() message(STATUS "##################################################") message(STATUS "Mumble version: ${version}") message(STATUS "Architecture: ${ARCH}") -message(STATUS "Build type: ${BUILD_STR}") +if(NOT IS_MULTI_CONFIG) + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +else() + message(STATUS "Using multi-config generator that will determine build type on-the-fly") +endif() message(STATUS "##################################################") # We have to check for BUILD_TESTING before including CTest as CTest defines this variable |