Prevent building in source dir

Fixes #1636
This commit is contained in:
Michał Janiszewski 2019-05-21 06:38:06 +02:00 committed by GitHub
parent 31537c43d9
commit bfb4ee1597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,10 @@ endif()
project(Catch2 LANGUAGES CXX VERSION 2.7.2) project(Catch2 LANGUAGES CXX VERSION 2.7.2)
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
endif()
# Provide path for scripts # Provide path for scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")