diff --git a/CMakeLists.txt b/CMakeLists.txt index aa8721e64..ec0592445 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,8 @@ configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst) configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm) -set(CMAKE_C_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -fPIC") -set(CMAKE_CXX_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -fPIC") +set(CMAKE_C_FLAGS "-Wall -Wno-unused-variable -Wno-unused-function -fPIC") +set(CMAKE_CXX_FLAGS "-Wall -Wno-unused-variable -Wno-unused-function -fPIC") set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4") if(CMAKE_VERSION VERSION_GREATER 2.6) @@ -49,6 +49,12 @@ if(CMAKE_VERSION VERSION_GREATER 2.6) message(STATUS "C Compiler supports: -Werror=format-security") set(DEBUG_FLAGS "${DEBUG_FLAGS} -Werror=format-security") endif() + + if((CMAKE_C_COMPILER_ID STREQUAL "GNU") AND (NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6))) + message(STATUS "C Compiler supports: -Wno-unused-but-set-variable") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable ") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable ") + endif() endif() if(BUILD_TYPE STREQUAL Debug)