Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor safeguards module #241

Merged
merged 1 commit into from
Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions modules/safeguards.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.")
endif()

string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
string(TOLOWER "${CMAKE_BUILD_TYPE}" _cmake_build_type_tolower)

if(NOT cmake_build_type_tolower STREQUAL "debug" AND
NOT cmake_build_type_tolower STREQUAL "release" AND
NOT cmake_build_type_tolower STREQUAL "minsizerel" AND
NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo, and MinSizeRel (case-insensitive).")
set(_available_types "debug" "release" "minsizerel" "relwithdebinfo")

if(NOT "${_cmake_build_type_tolower}" IN_LIST _available_types)
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are: ${_available_types}.")
endif()