authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-02-12 17:23:48-05:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-02-12 17:23:48-05:00
log471662f7c94b881821803b4d1379deee5e6d59ae
tree7b2aebebb0adfe0d0ddc45cc5f48fff4c6d1e85c
parentab4ea5d3cf5a96cd596df14515521843ca4dccad
signaturelock-open Commit is signed but in an unrecognized format.

stage1: limit cmake checks on build type

Various maintainers pass custom build types and we don't need to check those. We are interested only in checking and diagnosing common errors for Zig project supported types. Check is now limited to look for case-mismatch only on the well-known values { Debug, Release, RelWithDebInfo, MinSizeRel }.

1 files changed, 15 insertions(+), 10 deletions(-)

CMakeLists.txt+15-10
...@@ -5,16 +5,21 @@ if(NOT CMAKE_BUILD_TYPE)...@@ -5,16 +5,21 @@ if(NOT CMAKE_BUILD_TYPE)
5 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)5 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
6endif()6endif()
77
8set(_list "None;Debug;Release;RelWithDebInfo;MinSizeRel")8set(_list "Debug;Release;RelWithDebInfo;MinSizeRel")
9list(FIND _list ${CMAKE_BUILD_TYPE} _index)9string(TOLOWER "${_list}" _list_lower)
10if(${_index} EQUAL -1)10string(TOLOWER ${CMAKE_BUILD_TYPE} _build_type_lower)
11 string(REPLACE ";" ", " _list_pretty "${_list}")11list(FIND _list_lower "${_build_type_lower}" _index)
12 message("::")12if(NOT ${_index} EQUAL -1)
13 message(":: ERROR: Invalid build type: ${CMAKE_BUILD_TYPE}")13 list(FIND _list "${CMAKE_BUILD_TYPE}" _index)
14 message("::")14 if(${_index} EQUAL -1)
15 message(":: valid types: { ${_list_pretty} }")15 string(REPLACE ";" ", " _list_pretty "${_list}")
16 message("::")16 message("::")
17 message(FATAL_ERROR)17 message(":: ERROR: build type case-mismatch: ${CMAKE_BUILD_TYPE}")
18 message("::")
19 message(":: valid types: { ${_list_pretty} }")
20 message("::")
21 message(FATAL_ERROR)
22 endif()
18endif()23endif()
1924
20if(NOT CMAKE_INSTALL_PREFIX)25if(NOT CMAKE_INSTALL_PREFIX)