Skip to content

Commit 8070847

Browse files
committed
fix: do not colored diagnostics for Cuda + Windows
1 parent 79dd950 commit 8070847

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/StandardProjectSettings.cmake

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,20 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1919

2020
# Enhance error reporting and compiler messages
2121
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
22-
add_compile_options(-fcolor-diagnostics)
22+
if(WIN32)
23+
# On Windows cuda nvcc uses cl and not clang
24+
add_compile_options($<$<COMPILE_LANGUAGE:C>:-fcolor-diagnostics> $<$<COMPILE_LANGUAGE:CXX>:-fcolor-diagnostics>)
25+
else()
26+
add_compile_options(-fcolor-diagnostics)
27+
endif()
2328
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
24-
add_compile_options(-fdiagnostics-color=always)
29+
if(WIN32)
30+
# On Windows cuda nvcc uses cl and not gcc
31+
add_compile_options($<$<COMPILE_LANGUAGE:C>:-fdiagnostics-color=always>
32+
$<$<COMPILE_LANGUAGE:CXX>:-fdiagnostics-color=always>)
33+
else()
34+
add_compile_options(-fdiagnostics-color=always)
35+
endif()
2536
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER 1900)
2637
add_compile_options(/diagnostics:column)
2738
else()

0 commit comments

Comments
 (0)