mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
cpu.cmake: fix compiler flag detection w/3.17.0+
Between 3.17.0 and 3.18.2 check_cxx_compiler_flag() sets a normal variable at parent scope while check_cxx_source_compiles() continues to set an internal cache variable, so we unset both to avoid the failure / success state persisting between checks. This was fixed in 3.18.3 [1], but regressed shortly afterward [2]; currently seen with 3.20.0 installed via homebrew. [1] https://gitlab.kitware.com/cmake/cmake/-/issues/21207 [2] 90dead024c CheckCompilerFlag: unified way to check compiler flags per language Change-Id: I57282f89b07a9cfd85aca7569380f7d115c0b3cf
This commit is contained in:
parent
a2e18f10eb
commit
327ef24fbd
@ -125,6 +125,12 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
|
||||
list(GET SIMD_DISABLE_FLAGS ${I_SIMD} SIMD_COMPILE_FLAG)
|
||||
include(CheckCCompilerFlag)
|
||||
if(SIMD_COMPILE_FLAG)
|
||||
# Between 3.17.0 and 3.18.2 check_cxx_compiler_flag() sets a normal
|
||||
# variable at parent scope while check_cxx_source_compiles() continues
|
||||
# to set an internal cache variable, so we unset both to avoid the
|
||||
# failure / success state persisting between checks. See
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/21207.
|
||||
unset(HAS_COMPILE_FLAG)
|
||||
unset(HAS_COMPILE_FLAG CACHE)
|
||||
check_c_compiler_flag(${SIMD_COMPILE_FLAG} HAS_COMPILE_FLAG)
|
||||
if(HAS_COMPILE_FLAG)
|
||||
@ -142,6 +148,7 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
|
||||
"warning: argument unused during compilation:"
|
||||
${COMMON_PATTERNS})
|
||||
if(NOT FLAG_${SIMD_COMPILE_FLAG})
|
||||
unset(HAS_COMPILE_FLAG)
|
||||
unset(HAS_COMPILE_FLAG CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user