]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not pass "-fdiagnostics-color" to as
authorKefu Chai <kchai@redhat.com>
Thu, 4 Mar 2021 08:46:05 +0000 (16:46 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 9 Mar 2021 11:13:22 +0000 (19:13 +0800)
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>
src/CMakeLists.txt

index 3572cb3fb4e847baa36218712cde29efc06931d7..1b45100eac8f85ad025244558ec2e1f7e7af5ac5 100644 (file)
@@ -187,7 +187,9 @@ set(DIAGNOSTICS_COLOR "auto"
   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})