File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,20 @@ else(NOT CMAKE_CROSSCOMPILING)
150150 message (STATUS "Assuming unaligned access is supported" )
151151endif (NOT CMAKE_CROSSCOMPILING )
152152
153+ # Clang warns on deprecated specialization used in system
154+ # headers. but libstdc++-12 uses deprecated get_temporary_buffer<>
155+ # to implement templated stable_sort(), which is turn used by
156+ # googletest. see https://github.com/llvm/llvm-project/issues/76515
157+ # Let's detect it, so we can disable -Wdeprecated-declarations when
158+ # building googletest.
159+ cmake_push_check_state(RESET)
160+ set (CMAKE_REQUIRED_FLAGS "-Werror=deprecated-declarations" )
161+ check_cxx_source_compiles("
162+ #include <algorithm>
163+ int main() { std::stable_sort((int *)0, (int*)0); }
164+ " COMPILER_IGNORES_DEPRECATED_DECL_IN_SYSTEM_HEADERS)
165+ cmake_pop_check_state()
166+
153167set (version_script_source "v1 { }; v2 { } v1;" )
154168file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /version_script.txt "${version_script_source} " )
155169cmake_push_check_state(RESET)
Original file line number Diff line number Diff line change @@ -767,6 +767,12 @@ if(WITH_TESTS)
767767 find_package (GTest 1.13.0 REQUIRED)
768768 find_package (GMock REQUIRED)
769769 else ()
770+ if (NOT COMPILER_IGNORES_DEPRECATED_DECL_IN_SYSTEM_HEADERS)
771+ # See https://github.com/llvm/llvm-project/issues/76515
772+ set_property (DIRECTORY googletest
773+ APPEND "-Wno-deprecated-declarations"
774+ PROPERTY COMPILE_OPTIONS)
775+ endif ()
770776 set (INSTALL_GTEST OFF CACHE BOOL "" FORCE)
771777 add_subdirectory (googletest)
772778 add_library (GMock::GMock ALIAS gmock)
You can’t perform that action at this time.
0 commit comments