From 3423ab5b3b23766dcdc14956b265432c7e222368 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 30 Apr 2014 12:05:51 +0200 Subject: [PATCH] build: check c++ compliler flags seperately Flags for C and C++ compiler need to be checked seperately since the c and c++ compiler might not support the same flags (even if they are the same version). --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90cdb98..02faa54 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,9 +119,11 @@ endif() CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined) if(Wno-builtin-macro-redefined) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") +endif() +CHECK_CXX_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefinedCXX) +if(Wno-builtin-macro-redefinedCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") endif() @@ -154,6 +156,9 @@ if(CMAKE_COMPILER_IS_GNUCC) CHECK_C_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarations) if(Wno-deprecated-declarations) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") + endif() + CHECK_CXX_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarationsCXX) + if(Wno-deprecated-declarationsCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") endif() if(NOT EXPORT_ALL_SYMBOLS) @@ -188,6 +193,9 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") CHECK_C_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarations) if(Wno-deprecated-declarations) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") + endif() + CHECK_CXX_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarationsCXX) + if(Wno-deprecated-declarationsCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") endif() endif() -- 2.7.4