[CMAKE] Rely less on CMAKE_BUILD_TYPE variable

Having conditional statements with CMAKE_BUILD_TYPE is an antipattern
See https://stackoverflow.com/questions/66079007/having-conditional-statements-on-build-type-variable-a-good-design

We use both single- and multi-config generators (Ninja and VS), so we
can't really rely on CMAKE_BUILD_TYPE, because it's not always set.

This commit alters some conditional flags to use <$CONFIG:...>
generator expression, but is still not complete. Also, our default
optimization level (4) now has what was always a de-facto flags
This commit is contained in:
Victor Perevertkin
2021-04-15 04:52:59 +03:00
parent f0b53998c8
commit d10728a645
4 changed files with 17 additions and 26 deletions

View File

@@ -49,6 +49,16 @@ else()
set(WINARCH ${ARCH})
endif()
# set CMAKE_BUILD_TYPE if not set
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to Debug as none was specified.")
set(CMAKE_BUILD_TYPE "Debug" 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()
# Versioning
include(sdk/include/reactos/version.cmake)