From 986cc784ce4b434cf465a517d10982777c9b5147 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Tue, 17 Feb 2015 11:37:32 +0200 Subject: [PATCH] Fix to bug 732: http://bugs.mariadb.com/show_bug.cgi?id=732 -Wno-unused-but-set-variable is now only used with GCC versions that support it. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)