Debian Codegraph @

prboom2/cmake/DsdaHelpers.cmake

raw
1 include_guard()
2
3 function(dsda_fail_if_invalid_target tgt)
4 if(NOT TARGET ${tgt})
5 message(FATAL_ERROR "${tgt} is not a valid CMake target.")
6 endif()
7 endfunction()
8
9 function(dsda_set_default_build_config build_config)
10 get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
11 if(NOT is_multi_config AND NOT CMAKE_BUILD_TYPE)
12 set(CMAKE_BUILD_TYPE "${build_config}"
13 CACHE STRING "Build configuration"
14 FORCE
15 )
16 set_property(
17 CACHE CMAKE_BUILD_TYPE
18 PROPERTY STRINGS
19 "Debug" "Release" "MinSizeRel" "RelWithDebInfo"
20 )
21 elseif(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
22 if(build_config IN_LIST CMAKE_CONFIGURATION_TYPES)
23 set(CMAKE_DEFAULT_BUILD_TYPE ${build_config})
24 else()
25 message(AUTHOR_WARNING "${build_config} is not a known config type.")
26 endif()
27 endif()
28 endfunction()