summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2021-07-09 22:22:56 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-07-09 22:22:56 +0000
commit46d844e6cf0f5895e96be619d637e11b9077128d (patch)
tree9264d476524569af09507ec2d2289b57649f3fec
parent298d26eac2827523f3cb561d5ba1a633d2bfac7c (diff)
parent327ef24fbdd3d6642a42404b01f1469912963e12 (diff)
downloadlibwebp-46d844e6cf0f5895e96be619d637e11b9077128d.tar.gz
Merge "cpu.cmake: fix compiler flag detection w/3.17.0+" into main
-rw-r--r--cmake/cpu.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake
index 255714b1..bc0dbc98 100644
--- a/cmake/cpu.cmake
+++ b/cmake/cpu.cmake
@@ -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()