[cmake] make CMAKE_BUILD_TYPE selectable

This commit is contained in:
akallabeth 2024-10-17 15:54:41 +02:00
parent fb1ce1eb53
commit 24954bf6ed
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

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)