mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
Ninja: Update showIncludes prefix detection for clang-cl 18
Since commit LLVM/Clang commit `5523fefb01c2` ([clang][lex] Use
preferred path separator in includer-relative lookup, 2023-09-08), part
of the upcoming 18.x release, the output format of the showIncludes flag
has changed, where it now prints paths with double backslashes:
Note: including file: .\\foo.h
Previously, we expected to see the path name in the form "./foo.h".
Extend the regex to match a path name starting with `.\`, in addition to
the existing matched patterns.
This commit is contained in:
committed by
Brad King
parent
a88acb0a41
commit
0d933fc0d9
@@ -1173,7 +1173,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
|
||||
ENCODING AUTO # cl prints in console output code page
|
||||
)
|
||||
string(REPLACE "\n" "\n " msg " ${out}")
|
||||
if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./|/)")
|
||||
if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./|\\.\\\\|/)")
|
||||
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE)
|
||||
string(APPEND msg "\nFound prefix \"${CMAKE_MATCH_2}\"")
|
||||
else()
|
||||
|
||||
@@ -47,6 +47,7 @@ if(WIN32)
|
||||
set(maybe_MAKE_PROGRAM "-DRunCMake_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
|
||||
endif()
|
||||
run_cmake_script(ShowIncludes-437-ClangCl-17 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-ClangCl-18 -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-English -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# 'clang-cl /showIncludes' prefix for clang-cl >= 18.
|
||||
set(expect "Note: including file: ")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake)
|
||||
@@ -0,0 +1 @@
|
||||
-- showIncludes='Note: including file: '
|
||||
3
Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-18.cmake
Normal file
3
Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-18.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CODEPAGE 437)
|
||||
set(VSLANG "clang-cl-18") # Special case for test, not a real VS value.
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
|
||||
@@ -36,6 +36,14 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
// clang-cl >= 18 (special case for test, not a real VS value).
|
||||
if (strcmp(vslang, "clang-cl-18") == 0) {
|
||||
if (cp == 437 || cp == 65001) {
|
||||
printf("Note: including file: .\\\\foo.h\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// msvc-wine (special case for test, not a real VS value).
|
||||
if (strcmp(vslang, "msvc-wine") == 0) {
|
||||
if (cp == 437 || cp == 65001) {
|
||||
|
||||
Reference in New Issue
Block a user