diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 70209575a2..f25d38cdbc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -428,9 +428,8 @@ if(PYBIND11_CUDA_TESTS) endif() foreach(target ${test_targets}) - if("${target}" STREQUAL "pybind11_tests") - set(test_files ${PYBIND11_TEST_FILES}) - else() + set(test_files ${PYBIND11_TEST_FILES}) + if(NOT "${target}" STREQUAL "pybind11_tests") set(test_files "") endif()