-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Downloaded from | ||
# https://github.com/coderefinery/autocmake/blob/master/modules/safeguards.cmake | ||
# * changed text of in-source message | ||
|
||
#.rst: | ||
# | ||
# Provides safeguards against in-source builds and bad build types. | ||
# | ||
# Variables used:: | ||
# | ||
# PROJECT_SOURCE_DIR | ||
# PROJECT_BINARY_DIR | ||
# CMAKE_BUILD_TYPE | ||
|
||
if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR}) | ||
message(FATAL_ERROR "In-source builds not allowed. Please run CMake from top directory and specify a build directory (e.g., cmake -S. -Bbuild).") | ||
endif() | ||
|
||
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) | ||
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper) | ||
|
||
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, MinSizeRel, RelWithDebInfo (case-insensitive).") | ||
endif() |