Skip to content

Commit 25b40d0

Browse files
committed
Guard so that downstream projects don't build all the test executables
1 parent 5020466 commit 25b40d0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ add_subdirectory("${PROJECT_NAME}")
5757

5858
include(CTest)
5959
option(BUILD_TESTING "Build the tests" ON)
60-
option(C89STRINGUTILS_BUILD_TESTING "Build the tests" ON)
60+
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
61+
option(C89STRINGUTILS_BUILD_TESTING "Build the tests" ON)
62+
else()
63+
option(C89STRINGUTILS_BUILD_TESTING "Build the tests" OFF)
64+
endif()
6165

6266
if (CDD_CHARSET STREQUAL "Unicode")
6367
add_compile_definitions(UNICODE _UNICODE)
@@ -124,3 +128,4 @@ write_basic_package_version_file(
124128
)
125129
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
126130
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
131+

0 commit comments

Comments
 (0)