diff options
| author | Martin Hořeňovský | 2019-10-18 18:47:57 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-10-18 18:49:44 +0200 |
| commit | 01ef7076f50f5f2b481ddf082e1afca3c926983f (patch) | |
| tree | 15ceea6bbebf837e46db237337af2038703a49ae | |
| parent | ae14a47360028c941f37a0f656c4d8ee78ab4837 (diff) | |
| download | catch3-01ef7076f50f5f2b481ddf082e1afca3c926983f.tar.gz | |
Allow in-tree builds where Catch2 is just a subproject
Closes #1773
Closes #1774
| -rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index edb91c43..2ead6759 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,16 @@ if(NOT DEFINED PROJECT_NAME) set(NOT_SUBPROJECT ON) endif() -project(Catch2 LANGUAGES CXX VERSION 2.10.0) - -if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) +# Catch2's build breaks if done in-tree. You probably should not build +# things in tree anyway, but we can allow projects that include Catch2 +# as a subproject to build in-tree as long as it is not in our tree. +if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") endif() + +project(Catch2 LANGUAGES CXX VERSION 2.10.0) + # Provide path for scripts list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") |