From 49007b7ff344ed147a14930f9973a967338811dc Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 22 Jul 2020 10:20:42 -0400 Subject: [PATCH] test: fix warning/error on Python 2 in 14/17 mode --- tests/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) 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)