mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 03:11:08 -06:00
Ninja: Restore detection of msvc-wine showIncludes prefix
Since commit 8f82e755f3 (Ninja: Fix detection of MSVC showIncludes
prefix in Italian, 2023-01-26, v3.26.0-rc1~20^2) our regex no longer
matches the output from `msvc-wine`, which uses forward slashes:
Note: including file: /path/to/foo.h
`cl /showIncludes` under Wine prints paths of the form `Z:\path\to\file`,
but the `msvc-wine` wrapper converts them to the form `/path/to/file` so
that native Ninja can be used. Update our regex to match the prefix
followed by a path with a leading forward slash.
Fixes: #24908
This commit is contained in:
@@ -1144,7 +1144,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()
|
||||
|
||||
@@ -51,6 +51,7 @@ if(WIN32)
|
||||
run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-Italian -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-437-WineMSVC -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-54936-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-65001-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
run_cmake_script(ShowIncludes-65001-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# 'msvc-wine -showIncludes' prefix.
|
||||
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-WineMSVC.cmake
Normal file
3
Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set(CODEPAGE 437)
|
||||
set(VSLANG "msvc-wine") # Special case for test, not a real VS value.
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
|
||||
@@ -36,6 +36,14 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
// msvc-wine (special case for test, not a real VS value).
|
||||
if (strcmp(vslang, "msvc-wine") == 0) {
|
||||
if (cp == 437 || cp == 65001) {
|
||||
printf("Note: including file: /c/foo.h\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// German.
|
||||
if (strcmp(vslang, "1031") == 0) {
|
||||
if (cp == 437 || cp == 65001) {
|
||||
|
||||
Reference in New Issue
Block a user