diff options
author | Simon Rettberg | 2023-01-20 11:19:18 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-01-20 11:19:18 +0100 |
commit | 86d4c128c4cffeff053479cc9f406074a558f419 (patch) | |
tree | a9ce0be3a0264902611020bb5e78d77dd210bd61 | |
parent | Turn deprecated-declarations into warning (diff) | |
download | pvs2-86d4c128c4cffeff053479cc9f406074a558f419.tar.gz pvs2-86d4c128c4cffeff053479cc9f406074a558f419.tar.xz pvs2-86d4c128c4cffeff053479cc9f406074a558f419.zip |
Mdernize CMakeLists.txt build type handling
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3521ea6..8bbbb20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,21 @@ ################################################################################ # General ################################################################################ +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) + +set(pvs2_BUILD_TYPES Release Debug) +get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(multi_config) + set(CMAKE_CONFIGURATION_TYPES "${pvs2_BUILD_TYPES}" CACHE STRING "list of supported configuration types" FORCE) +else() + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type of the project.") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${pvs2_BUILD_TYPES}") + if(NOT CMAKE_BUILD_TYPE IN_LIST pvs2_BUILD_TYPES) + message(FATAL_ERROR "Invalid build type '${CMAKE_BUILD_TYPE}'. Possible values:\n ${pvs2_BUILD_TYPES}") + endif() +endif() PROJECT(pvs2) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) SET(EXTRA_C_FLAGS "" CACHE STRING "Additional options to pass to C compiler") SET(EXTRA_CXX_FLAGS "" CACHE STRING "Additional options to pass to C++ compiler") |