diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 75d64d344..1231f49ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -375,6 +375,9 @@ endif() check_include_files(endian.h HAVE_ENDIAN_H) +if((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND EXISTS "${PROJECT_SOURCE_DIR}/cmake_config.h") + message(FATAL_ERROR "You are doing an out-of-tree build, but build artifacts are left in-tree. This will break the build!") +endif() configure_file( "${PROJECT_SOURCE_DIR}/cmake_config.h.in" "${PROJECT_BINARY_DIR}/cmake_config.h"