From 47f154ae4cdefbdb7f9d86c0017acfe118db260e Mon Sep 17 00:00:00 2001 From: Frankie Dintino Date: Mon, 5 Aug 2024 14:11:56 -0700 Subject: [PATCH] Fix empty CMAKE_CXX_FLAGS_RELEASE if libaom local Fix empty CMAKE_CXX_FLAGS_RELEASE if libaom is built locally using FetchContent and AVIF_LIBYUV is OFF. libaom sets CMAKE_CXX_FLAGS_RELEASE and other flags as CACHE variables. To undo the changes libaom makes, unset the variables as cache variables so that they can be reset to their original values as normal variables. Fix https://github.com/AOMediaCodec/libavif/issues/2365. --- CHANGELOG.md | 2 ++ cmake/Modules/LocalAom.cmake | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efbdc6266d..c270db2aa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ The changes are relative to the previous release, unless the baseline is specifi ### Changed since 1.1.1 * avifenc: Allow large images to be encoded. +* Fix empty CMAKE_CXX_FLAGS_RELEASE if -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=OFF + is specified. https://github.com/AOMediaCodec/libavif/issues/2365. ## [1.1.1] - 2024-07-30 diff --git a/cmake/Modules/LocalAom.cmake b/cmake/Modules/LocalAom.cmake index d7f83f561e..268cd671a9 100644 --- a/cmake/Modules/LocalAom.cmake +++ b/cmake/Modules/LocalAom.cmake @@ -143,9 +143,11 @@ else() endif() avif_set_aom_compile_options(aom ${_aom_config}) + # Restore the variables. foreach(_config_setting CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS) foreach(_config_type DEBUG RELEASE MINSIZEREL RELWITHDEBINFO) - set(${_config_setting}_${_config_type} ${${_config_setting}_${_config_type}_ORIG} CACHE STRING "" FORCE) + unset(${_config_setting}_${_config_type} CACHE) + set(${_config_setting}_${_config_type} ${${_config_setting}_${_config_type}_ORIG}) unset(${_config_setting}_${_config_type}_ORIG) endforeach() endforeach()