Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Allow in-tree builds where Catch2 is just a subproject

Closes #1773
Closes #1774
Commit
01ef7076f50f5f2b481ddf082e1afca3c926983f
Author
Martin Hořeňovský ·
Parents
ae14a4736002

Files · Download .tar.gz

Changes

 CMakeLists.txt | 10 +++++++---
 1 file 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")