Disable GCC warnings in googletest headers
This is the GCC version of
https://aomedia-review.googlesource.com/c/aom/+/188601.
We may be able to fix the warnings by upgrading to a newer version of
googletest, but that requires updating some of our tests. It is easier
to just disable the -Wdeprecated-copy warning.
Use usage_exit.cc instead of usage_exit.c in C++ test targets so that we
can use the -Wno-deprecated-copy compiler option (which is valid for
C++/ObjC++ but not for C) to compile all files in the C++ test targets.
Change-Id: I2a718665c16371f9df1a5dac4ece8b96481fcda1
diff --git a/test/test.cmake b/test/test.cmake
index 767cd3e..e15c4b4 100644
--- a/test/test.cmake
+++ b/test/test.cmake
@@ -19,7 +19,7 @@
set(AOM_UNIT_TEST_DATA_LIST_FILE "${AOM_ROOT}/test/test-data.sha1")
-list(APPEND AOM_UNIT_TEST_WRAPPER_SOURCES "${AOM_CONFIG_DIR}/usage_exit.c"
+list(APPEND AOM_UNIT_TEST_WRAPPER_SOURCES "${AOM_CONFIG_DIR}/usage_exit.cc"
"${AOM_ROOT}/test/test_libaom.cc")
list(APPEND AOM_UNIT_TEST_COMMON_SOURCES
@@ -77,7 +77,7 @@
list(APPEND AOM_DECODE_PERF_TEST_SOURCES "${AOM_ROOT}/test/decode_perf_test.cc")
list(APPEND AOM_ENCODE_PERF_TEST_SOURCES "${AOM_ROOT}/test/encode_perf_test.cc")
list(APPEND AOM_UNIT_TEST_WEBM_SOURCES "${AOM_ROOT}/test/webm_video_source.h")
-list(APPEND AOM_TEST_INTRA_PRED_SPEED_SOURCES "${AOM_CONFIG_DIR}/usage_exit.c"
+list(APPEND AOM_TEST_INTRA_PRED_SPEED_SOURCES "${AOM_CONFIG_DIR}/usage_exit.cc"
"${AOM_ROOT}/test/test_intra_pred_speed.cc")
if(NOT BUILD_SHARED_LIBS)
@@ -238,6 +238,14 @@
PUBLIC -Wno-deprecated-copy-with-user-provided-copy)
endif()
endif()
+ # Disable the following GCC warning in googletest headers: implicitly-
+ # declared '...' is deprecated
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ check_cxx_compiler_flag("-Wdeprecated-copy" HAVE_DEPRECATED_COPY_WARNING)
+ if(HAVE_DEPRECATED_COPY_WARNING)
+ target_compile_options(aom_gtest PUBLIC -Wno-deprecated-copy)
+ endif()
+ endif()
# The definition of GTEST_HAS_PTHREAD must be public, since it's checked by
# interface headers, not just by the implementation.