NEW: disallow in-source builds

This commit is contained in:
jkriege2 2024-01-14 16:55:06 +01:00
parent f07c013c7f
commit fad34678f1
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# Find includes in the build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# error message when user tries to make in-source build!
include(jkqtplotter_noInsourceBuilds)
# Common Includes for JKQtPlotter
include(jkqtplotter_common_include)

View File

@ -0,0 +1,11 @@
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR
"\n"
"In-source builds are not allowed.\n"
"Instead, provide a path to build tree like so:\n"
"cmake -B <destination>\n"
"\n"
"To remove files you accidentally created execute:\n"
"rm -rf CMakeFiles CMakeCache.txt\n"
)
endif()