Merge pull request #4390 from mikdusan/cherry-pick

stage1: guard against case-mismatched build types
master
Michael Dusan 2020-02-04 22:34:46 -05:00 committed by GitHub
commit 25cbee0b84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -5,6 +5,18 @@ if(NOT CMAKE_BUILD_TYPE)
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
set(_list "Debug;Release;RelWithDebInfo;MinSizeRel")
list(FIND _list ${CMAKE_BUILD_TYPE} _index)
if(${_index} EQUAL -1)
string(REPLACE ";" ", " _list_pretty "${_list}")
message("::")
message(":: ERROR: Invalid build type: ${CMAKE_BUILD_TYPE}")
message("::")
message(":: valid types: { ${_list_pretty} }")
message("::")
message(FATAL_ERROR)
endif()
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING
"Directory to install zig to" FORCE)