test: fix warning/error on Python 2 in 14/17 mode

This commit is contained in:
Henry Schreiner 2020-07-22 10:20:42 -04:00 committed by Henry Schreiner
parent 3d20b73e87
commit 49007b7ff3

View File

@ -151,6 +151,14 @@ function(pybind11_enable_warnings target_name)
target_compile_options(${target_name} PRIVATE -Werror) target_compile_options(${target_name} PRIVATE -Werror)
endif() endif()
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() endfunction()
set(test_targets pybind11_tests) set(test_targets pybind11_tests)