Merge pull request #10755 from akallabeth/cmake-choice

[cmake] make CMAKE_BUILD_TYPE selectable
This commit is contained in:
akallabeth 2024-10-17 16:12:05 +02:00 committed by GitHub
commit 782f349bd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,8 +30,16 @@ if (NOT ANDROID)
endif()
# Default to release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "project default")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Set a default build type if none was specified
set(default_build_type "Release")
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
include(PlatformDefaults)