summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2013-07-21 18:12:20 +0000
committerJörg Mayer <jmayer@loplof.de>2013-07-21 18:12:20 +0000
commit9e7b6f1a69c516579ffd4618f89e20559d738666 (patch)
treedbd28077599f8501bd805bb357e0fb3398877807 /CMakeLists.txt
parentf506b45c321d0b0ddcb7386ef14b3859fe9ee4b4 (diff)
downloadwireshark-9e7b6f1a69c516579ffd4618f89e20559d738666.tar.gz
Try to generate an error when calling clang with an unknown compiler
option. This behaviour changed in clang, see https://bugzilla.mozilla.org/show_bug.cgi?id=731316 svn path=/trunk/; revision=50760
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 13 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d92ac6e392..4ff0bb6f2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,6 +191,19 @@ add_definitions(
# Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
include(CheckCCompilerFlag)
+
+if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
+ check_c_compiler_flag(-Werror=unknown-warning-option WERR_UNKNOWN)
+ check_c_compiler_flag(-Werror WERROR)
+else()
+ unset(WERR_UNKNOWN)
+ unset(WERROR)
+endif()
+# string of additional compile command line flags for check_c_compiler_flag
+if(WERR_UNKNOWN)
+ set(CMAKE_REQUIRED_FLAGS -Werror=unknown-warning-option )
+endif()
+
set(C 0)
# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
@@ -225,12 +238,6 @@ else() # TODO add alternate compiler flags for hiding symbols
" All shared library symbols will be exported.")
endif()
-if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
- check_c_compiler_flag(-Werror WERROR)
-else()
- unset(WERROR)
-endif()
-
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER MATCHES ".*clang" OR
CMAKE_CXX_COMPILER MATCHES ".*clang")
set (C_UNUSED "__attribute__((unused))" )