Skip to content

Commit cdad8c9

Browse files
committed
chore: disable BUILD_TESTING when fetched as a subproject
1 parent 8c15f87 commit cdad8c9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ configure_file(
300300

301301
add_subdirectory("${PROJECT_NAME}")
302302

303-
option(BUILD_TESTING_${PROJECT_NAME} "Build the tests" ON)
303+
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
304+
option(BUILD_TESTING_${PROJECT_NAME} "Build the tests" ON)
305+
else()
306+
option(BUILD_TESTING_${PROJECT_NAME} "Build the tests" OFF)
307+
endif()
304308

305309
set(CDD_CHARSET "Unicode" CACHE STRING "Charset to use: Unicode or ANSI")
306310
set(CDD_THREADING "Multi-threaded" CACHE STRING "Threading: Multi-threaded or Single-threaded")

0 commit comments

Comments
 (0)