From d282d479bb6b6254ce524eb73d62fb22b0edcffb Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Wed, 10 Apr 2019 22:59:49 +0000 Subject: [PATCH] cmake: check compiler version before adding -Wno-misleading-indentation flag Signed-off-by: Mihai Tudor Panu --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1a90dac..01bc21b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,13 +91,16 @@ endfunction () # Compiler flags common to both C and CXX # Enable -Wall -# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now set (C_CXX_WARNING_FLAGS -Wall - -Wno-misleading-indentation -Wno-strict-aliasing -Wno-deprecated-declarations # Temp fix for MRAA deprecated methods ) +# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6") + list (APPEND C_CXX_WARNING_FLAGS -Wno-misleading-indentation) +endif () + # Warnings as errors? if (WERROR) list (APPEND C_CXX_WARNING_FLAGS -Werror)