From 98339a35355d6870a87b3be3cb542cd630935f53 Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Mon, 12 Aug 2024 13:22:29 -0700
Subject: [PATCH] cmake: check for -Wmissing-declarations support
Bug: aomedia:3416
Change-Id: Ic4eee8b758f91f8689f4a7ff832bca7803f383a9
---
CMakeLists.txt | 6 ++++++
build/cmake/aom_configure.cmake | 1 +
2 files changed, 7 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05dcd57d6..9f9a1b395 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -472,6 +472,12 @@ if(CONFIG_LIBYUV OR CONFIG_TUNE_BUTTERAUGLI)
add_library(yuv OBJECT ${AOM_LIBYUV_SOURCES})
if(NOT MSVC)
target_compile_options(yuv PRIVATE -Wno-shadow)
+ # Many functions in libyuv trigger this warning when enabled with gcc and
+ # clang.
+ is_flag_present(AOM_CXX_FLAGS "-Wmissing-declarations" flag_present)
+ if(flag_present)
+ target_compile_options(yuv PRIVATE -Wno-missing-declarations)
+ endif()
# Many functions in libyuv trigger this warning when enabled with clang.
is_flag_present(AOM_CXX_FLAGS "-Wmissing-prototypes" flag_present)
if(flag_present)
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index 44fe8b757..418ecfac1 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -343,6 +343,7 @@ else()
add_compiler_flag_if_supported("-Wformat=2")
add_c_flag_if_supported("-Wimplicit-function-declaration")
add_compiler_flag_if_supported("-Wlogical-op")
+ add_compiler_flag_if_supported("-Wmissing-declarations")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compiler_flag_if_supported("-Wmissing-prototypes")
else()