this option can be understood by GCC. see
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
Signed-off-by: Kefu Chai <kchai@redhat.com>
CACHE STRING "Used if the C/C++ compiler supports the -fdiagnostics-color option. May have one of three values -- 'auto' (default), 'always', or 'never'. If set to 'always' and the compiler supports the option, 'make [...] | less -R' will make visible diagnostics colorization of compiler output.")
if(COMPILER_SUPPORTS_DIAGNOSTICS_COLOR)
- add_compile_options(-fdiagnostics-color=${DIAGNOSTICS_COLOR})
+ add_compile_options(
+ "$<$<COMPILE_LANGUAGE:C>:-fdiagnostics-color=${DIAGNOSTICS_COLOR}>"
+ "$<$<COMPILE_LANGUAGE:CXX>:-fdiagnostics-color=${DIAGNOSTICS_COLOR}>")
endif()
set(EXTRALIBS ${CMAKE_DL_LIBS})