From c7bc47c60d586cb3cc0dcaee6e35d7499059d4c3 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Fri, 19 Apr 2024 11:42:07 -0700 Subject: [PATCH] cmake: compiler: Check -fdiagnostics-color=always before using The -fdiagnostics-color flag is only on GCC versions 4.9.0 and newer. Previously, CMake only checked that the compiler was not the XCC compiler before using the flag. However, given that the flag us unavailable on compilers other than XCC, e.g. old versions of GCC, this patch replaces the previous logic with a flag-check using the check_set_compiler_property() CMake function. Signed-off-by: Joel Holdsworth --- cmake/compiler/gcc/compiler_flags.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 204df61d01a..15070fe4e93 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -232,9 +232,7 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe set_property(TARGET asm PROPERTY required "-xassembler-with-cpp") # gcc flag for colourful diagnostic messages -if (NOT COMPILER STREQUAL "xcc") -set_compiler_property(PROPERTY diagnostic -fdiagnostics-color=always) -endif() +check_set_compiler_property(PROPERTY diagnostic -fdiagnostics-color=always) # Compiler flag for disabling pointer arithmetic warnings set_compiler_property(PROPERTY warning_no_pointer_arithmetic "-Wno-pointer-arith")