diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e4aba7567..d36362ebb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -151,6 +151,14 @@ function(pybind11_enable_warnings target_name) target_compile_options(${target_name} PRIVATE -Werror) endif() endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND PYTHON_VERSION VERSION_LESS 3.0) + if(CMAKE_CXX_STANDARD STREQUAL "14") + target_compile_options(${target_name} PUBLIC -Wno-deprecated-register) + elseif(NOT CMAKE_CXX_STANDARD VERSION_LESS 17) + target_compile_options(${target_name} PUBLIC -Wno-register) + endif() + endif() endfunction() set(test_targets pybind11_tests)