summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-10-23 16:06:14 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-10-23 16:06:33 (GMT)
commitb99e99e1aa3125eca923221c976b3bc6ad8d6b09 (patch)
tree8915100541083b7253937f79d39bd8ba5f0c4a37
parent34c51a385bd0d3583f39444830012ed00b99a353 (diff)
parent74b5fae52d24e6fcfacee33441ae9fae2efbfaf7 (diff)
downloadCMake-b99e99e1aa3125eca923221c976b3bc6ad8d6b09.zip
CMake-b99e99e1aa3125eca923221c976b3bc6ad8d6b09.tar.gz
CMake-b99e99e1aa3125eca923221c976b3bc6ad8d6b09.tar.bz2
Merge topic 'clang-ansi-color' into release-3.28
74b5fae52d Clang: Use -fno-ansi-escape-codes for color diagnostics on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8900
-rw-r--r--Modules/Compiler/Clang.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index e5683c2..4c033ca 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -117,8 +117,14 @@ else()
# '-fcolor-diagnostics' introduced since Clang 2.6
if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2.6)
- set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS "-fcolor-diagnostics")
- set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF "-fno-color-diagnostics")
+ # -fansi-escape-codes mentioned at https://releases.llvm.org/3.7.0/tools/clang/docs/UsersManual.html
+ if (CMAKE_HOST_WIN32 AND CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.7)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS -fansi-escape-codes -fcolor-diagnostics)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF -fno-ansi-escape-codes -fno-color-diagnostics)
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS -fcolor-diagnostics)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF -fno-color-diagnostics)
+ endif()
endif()
endmacro()
endif()