remove Clang warnings with unused arch arguments.

This is duplicating code from compiler flag checking that was once
added (then reverted to CMake) as the problem seem to be on the
clang side as detailed in:
http://public.kitware.com/Bug/view.php?id=13194

I also tried to remove a similar warning with pthreads but there
is also an issue on the clang side:
https://llvm.org/bugs/show_bug.cgi?id=7798

Change-Id: I5b0061f0f71e49b493c5ee0c98f70533c28164bd
This commit is contained in:
Vincent Rabaud 2016-12-19 17:07:33 +01:00
parent 67c25ad5b4
commit abb5482731

View File

@ -87,6 +87,23 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
if(SIMD_COMPILE_FLAG)
unset(HAS_COMPILE_FLAG CACHE)
check_c_compiler_flag(${SIMD_COMPILE_FLAG} HAS_COMPILE_FLAG)
if(HAS_COMPILE_FLAG)
# Do one more check for Clang to circumvent CMake issue 13194.
if(COMMAND check_compiler_flag_common_patterns)
# Only in CMake 3.0 and above.
check_compiler_flag_common_patterns(COMMON_PATTERNS)
else()
set(COMMON_PATTERNS)
endif()
set(CMAKE_REQUIRED_DEFINITIONS ${SIMD_COMPILE_FLAG})
check_c_source_compiles("int main(void) {return 0;}" FLAG2
FAIL_REGEX "warning: argument unused during compilation:"
${COMMON_PATTERNS}
)
if(NOT FLAG2)
unset(HAS_COMPILE_FLAG CACHE)
endif()
endif()
if(HAS_COMPILE_FLAG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SIMD_COMPILE_FLAG}")
endif()