Skip to content

Commit 69821d9

Browse files
authored
Disable testing when using BUILD_TESTING (#1682)
1 parent cf0a645 commit 69821d9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ if(PYBIND11_INSTALL)
272272
endif()
273273
endif()
274274

275-
if(PYBIND11_TEST OR (BUILD_TESTING AND PYBIND11_MASTER_PROJECT))
276-
add_subdirectory(tests)
275+
# BUILD_TESTING takes priority, but only if this is the master project
276+
if(PYBIND11_MASTER_PROJECT AND DEFINED BUILD_TESTING)
277+
if(BUILD_TESTING)
278+
add_subdirectory(tests)
279+
endif()
280+
else()
281+
if(PYBIND11_TEST)
282+
add_subdirectory(tests)
283+
endif()
277284
endif()

0 commit comments

Comments
 (0)