diff options
author | Jörg Mayer <jmayer@loplof.de> | 2013-07-21 18:12:20 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2013-07-21 18:12:20 +0000 |
commit | 9e7b6f1a69c516579ffd4618f89e20559d738666 (patch) | |
tree | dbd28077599f8501bd805bb357e0fb3398877807 | |
parent | f506b45c321d0b0ddcb7386ef14b3859fe9ee4b4 (diff) | |
download | wireshark-9e7b6f1a69c516579ffd4618f89e20559d738666.tar.gz wireshark-9e7b6f1a69c516579ffd4618f89e20559d738666.tar.bz2 wireshark-9e7b6f1a69c516579ffd4618f89e20559d738666.zip |
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
-rw-r--r-- | CMakeLists.txt | 19 |
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))" ) |