Check flags that might be supported by both C and C++ still
authorjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 3 Jan 2014 00:40:21 +0000 (00:40 +0000)
committerjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 3 Jan 2014 00:40:21 +0000 (00:40 +0000)
separately.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@54573 f5534014-38df-0310-8fa8-9805f1628bb7

CMakeLists.txt

index bd2952002381a97a78148db72a6bb0f63780b007..39fc2d96b6e3dfb549fa1884f6188f494411c8b6 100644 (file)
@@ -272,6 +272,7 @@ endif()
 
 # Counterhack to work around some cache magic in CHECK_C_SOURCE_COMPILES
 include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
 
 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
        check_c_compiler_flag(-Werror=unknown-warning-option WERR_UNKNOWN)
@@ -291,10 +292,20 @@ foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
        set(F WS_C_FLAG_${C})
        set(${F} ${THIS_FLAG})
        set(V WS_C_FLAG_VALID${C})
-       message(STATUS "Checking for flag: ${${F}}")
+       message(STATUS "Checking for c-compiler flag: ${${F}}")
        check_c_compiler_flag(${${F}} ${V})
        if (${${V}})
                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${F}}")
+       endif()
+       math(EXPR C "${C} + 1")
+endforeach()
+foreach(THIS_FLAG ${WIRESHARK_C_FLAGS})
+       set(F WS_C_FLAG_${C})
+       set(${F} ${THIS_FLAG})
+       set(V WS_C_FLAG_VALID${C})
+       message(STATUS "Checking for c++-compiler flag: ${${F}}")
+       check_cxx_compiler_flag(${${F}} ${V})
+       if (${${V}})
                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${F}}")
        endif()
        math(EXPR C "${C} + 1")