Doxygen: set warning format for MSVC builds

When using Visual Studio (MSVC), have Doxygen output its warnings with
the file/line prefix in the MSVC standard, so that double-clicking on
the warnings brings you to the right source location.

Change-Id: If492f83a651cf6d4a38186c9e36ffcb57f1d72ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55801
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c46cf2..47a130a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,11 +149,18 @@
     if(TINT_DOCS_WARN_AS_ERROR)
       set(DOXYGEN_WARN_AS_ERROR YES)
     endif()
+
+    set(DOXYGEN_WARN_FORMAT "$file:$line: $text")
+    if (MSVC)
+      set(DOXYGEN_WARN_FORMAT "$file($line): $text")
+    endif()
+
     add_custom_target(tint-docs ALL
         COMMAND ${CMAKE_COMMAND}
           -E env
           "DOXYGEN_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}/docs"
           "DOXYGEN_WARN_AS_ERROR=${DOXYGEN_WARN_AS_ERROR}"
+          "DOXYGEN_WARN_FORMAT=${DOXYGEN_WARN_FORMAT}"
           ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
         COMMENT "Generating API documentation"
diff --git a/Doxyfile b/Doxyfile
index 0fe2602..63bbc67 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -767,7 +767,7 @@
 # FILE_VERSION_FILTER)
 # The default value is: $file:$line: $text.
 
-WARN_FORMAT            = "$file:$line: $text"
+WARN_FORMAT             = $(DOXYGEN_WARN_FORMAT)
 
 # The WARN_LOGFILE tag can be used to specify a file to which warning and error
 # messages should be written. If left blank the output is written to standard