From 69821d9e755b4bc16f644067272a5399a5afcc4c Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Tue, 18 Aug 2020 07:34:18 -0500 Subject: [PATCH] Disable testing when using BUILD_TESTING (#1682) --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3571e33e..f38a8f89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,13 @@ if(PYBIND11_INSTALL) endif() endif() -if(PYBIND11_TEST OR (BUILD_TESTING AND PYBIND11_MASTER_PROJECT)) - add_subdirectory(tests) +# BUILD_TESTING takes priority, but only if this is the master project +if(PYBIND11_MASTER_PROJECT AND DEFINED BUILD_TESTING) + if(BUILD_TESTING) + add_subdirectory(tests) + endif() +else() + if(PYBIND11_TEST) + add_subdirectory(tests) + endif() endif()