Robustify toolchain string matching

This commit is contained in:
Lorenz Meier
2015-10-25 14:35:46 +01:00
parent e0d346e49d
commit 6c3c18b7c9
2 changed files with 4 additions and 105 deletions
+4 -10
View File
@@ -512,7 +512,7 @@ function(px4_add_common_flags)
list(APPEND warnings -Wframe-larger-than=1024)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
# QuRT 6.4.X compiler identifies as Clang but does not support this option
if (NOT ${OS} STREQUAL "qurt")
list(APPEND warnings
@@ -540,7 +540,7 @@ function(px4_add_common_flags)
-fdata-sections
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
list(APPEND optimization_flags
-fno-strength-reduce
-fno-builtin-printf
@@ -554,7 +554,7 @@ function(px4_add_common_flags)
-Wnested-externs
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
list(APPEND c_warnings
-Wold-style-declaration
-Wmissing-parameter-type
@@ -633,16 +633,10 @@ function(px4_add_common_flags)
-DCONFIG_ARCH_BOARD_${board_config}
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(added_exe_link_flags
-Wl,--warn-common
-Wl,--gc-sections
)
else()
set(added_exe_link_flags
-Wl,--warn-common
)
endif()
# output
foreach(var ${inout_vars})