From 23245fb4185171c1e687a8bc64f4e1f148e6e7ea Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 3 Sep 2022 11:35:33 +0100 Subject: [PATCH] Reset the diagnostic syntax in clang-cl builds. I've only just found out that you can set it back to the Unix-like syntax, which I find more convenient. --- cmake/platforms/windows.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index 52d2607d..c4299b2c 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -110,6 +110,16 @@ if(STRICT) endif() endif() +if(CMAKE_C_COMPILER_ID MATCHES "Clang") + # Switch back from MSVC-style error message format + # "file.c(line,col)" to clang's native style "file.c:line:col:". I + # find the latter more convenient because it matches other Unixy + # tools like grep, and I have tooling to parse that format and jump + # to the sites of error messages. + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -Xclang -fdiagnostics-format -Xclang clang") +endif() + if(CMAKE_C_COMPILER_ID MATCHES "MSVC") # Turn off some warnings that I've just found too noisy. #