From: ThorstenB Date: Sat, 5 May 2012 07:46:11 +0000 (+0200) Subject: Fix C compiler warning. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6129de31f007d95897438963e709b04e9929b7a1;p=simgear.git Fix C compiler warning. "no-overloaded-virtual" warnings are a CXX-compiler feature --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 215ecd09..45e08ab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,8 +191,9 @@ check_cxx_source_compiles( HAVE_ISNAN) if(CMAKE_COMPILER_IS_GNUCXX) - set(WARNING_FLAGS -Wall) - + set(WARNING_FLAGS_CXX "-Wall") + set(WARNING_FLAGS_C "-Wall") + # certain GCC versions don't provide the atomic builds, and hence # require is to provide them in SGAtomic.cxx set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH}) @@ -201,6 +202,11 @@ if(CMAKE_COMPILER_IS_GNUCXX) GCC_ATOMIC_BUILTINS_FOUND) endif(CMAKE_COMPILER_IS_GNUCXX) +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(WARNING_FLAGS_CXX "-Wall -Wno-overloaded-virtual") + set(WARNING_FLAGS_C "-Wall") +endif() + if(WIN32) if(MINGW) @@ -221,14 +227,10 @@ if(WIN32) set( WINSOCK_LIBRARY "ws2_32.lib" ) set( RT_LIBRARY "winmm" ) -endif(WIN32) - -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set (WARNING_FLAGS "-Wall -Wno-overloaded-virtual") -endif() +endif(WIN32) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}") include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_BINARY_DIR}/simgear)