Commit 3f62de0edd for aom
commit 3f62de0eddedb9a246d32b150d6bc47baa790282
Author: James Zern <jzern@google.com>
Date: Tue Jun 16 13:27:09 2026 -0700
cmake: fix compiler flag propagation after 3.30.0
Since https://gitlab.kitware.com/cmake/cmake/-/commit/cebcc07a80,
`check_symbol_exists()` will modify `CMAKE_<LANG>_FLAGS{,_<CONFIG>}` and
then restore the values afterward. This will create a normal variable
which will override the cached variable libaom uses in checking for
flags (in e.g., `require_c_flag()`). Due to the level of scope involved,
it's easier to clear the normal variable rather than try to propagate
the value up through the intermediate scopes.
Bug: 474642915, 524319756
Fixed: 524319756
Change-Id: Iaffaa9fe73d6647e84ea700ed696d40fd6e05ee3
diff --git a/cmake/aom_configure.cmake b/cmake/aom_configure.cmake
index 0401386396..52aa37e24b 100644
--- a/cmake/aom_configure.cmake
+++ b/cmake/aom_configure.cmake
@@ -265,6 +265,26 @@ if(HAVE_PTHREAD_H)
check_symbol_exists(pthread_setname_np pthread.h _HAS_PTHREAD_SETNAME_NP)
aom_pop_var(CMAKE_REQUIRED_DEFINITIONS)
+ # Since https://gitlab.kitware.com/cmake/cmake/-/commit/cebcc07a80 (included
+ # in 3.30.0), check_symbol_exists() will modify CMAKE_<LANG>_FLAGS{,_<CONFIG>}
+ # and then restore the values afterward. This will create a normal variable
+ # which will override the cached variable libaom uses in checking for flags.
+ # Due to the level of scope involved, it's easier to clear the normal variable
+ # rather than try to propagate the value up through the intermediate scopes.
+ if(CMAKE_TRY_COMPILE_CONFIGURATION)
+ string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" tc_config)
+ else()
+ set(tc_config "DEBUG")
+ endif()
+ set(tc_config "CMAKE_C_FLAGS_${tc_config}")
+ foreach(config ${AOM_C_CONFIGS})
+ if(${config} STREQUAL ${tc_config})
+ unset(${config})
+ break()
+ endif()
+ endforeach()
+ unset(tc_config)
+
set(HAVE_PTHREAD_SETNAME_NP ${_HAS_PTHREAD_SETNAME_NP})
endif()