Skip to content

Commit d282d47

Browse files
committed
cmake: check compiler version before adding -Wno-misleading-indentation flag
Signed-off-by: Mihai Tudor Panu <[email protected]>
1 parent d256a22 commit d282d47

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ endfunction ()
9191

9292
# Compiler flags common to both C and CXX
9393
# Enable -Wall
94-
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
9594
set (C_CXX_WARNING_FLAGS -Wall
96-
-Wno-misleading-indentation
9795
-Wno-strict-aliasing
9896
-Wno-deprecated-declarations # Temp fix for MRAA deprecated methods
9997
)
10098

99+
# GCC-6 added -Wmisleading-indentation to -Wall, skip these for now
100+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6")
101+
list (APPEND C_CXX_WARNING_FLAGS -Wno-misleading-indentation)
102+
endif ()
103+
101104
# Warnings as errors?
102105
if (WERROR)
103106
list (APPEND C_CXX_WARNING_FLAGS -Werror)

0 commit comments

Comments
 (0)