Skip to content

Commit ed1e6e2

Browse files
committed
Disable testing if cloned non-recursively
1 parent 62eee5f commit ed1e6e2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ cmake_minimum_required(VERSION 3.11)
55
set(CMAKE_CXX_STANDARD 14)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77

8-
add_subdirectory(ext/Catch2)
9-
include(CTest)
10-
118
# When building documentation from readthedocs.io, we need to
129
# run CMake, but we do not need to build C++ code, so we should
1310
# skip any required dependencies.
@@ -31,9 +28,15 @@ target_link_libraries(cerberus-cpp INTERFACE yaml-cpp)
3128
# Add an alias target for use if this project is included as a subproject in another project
3229
add_library(cerberus-cpp::cerberus-cpp ALIAS cerberus-cpp)
3330

34-
# Documentation and testing subdirectories
31+
# Add documentation building
3532
add_subdirectory(doc)
36-
add_subdirectory(test)
33+
34+
# Add the testing subdirectories
35+
if(EXISTS ${CMAKE_SOURCE_DIR}/ext/Catch2/CMakeLists.txt)
36+
include(CTest)
37+
add_subdirectory(ext/Catch2)
38+
add_subdirectory(test)
39+
endif()
3740

3841
# Installation rules
3942
include(GNUInstallDirs)

0 commit comments

Comments
 (0)