-
Notifications
You must be signed in to change notification settings - Fork 5k
Normalize the paths to ensure install works on newer versions of cmake #115571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CC. @elinor-fung |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR normalizes Windows install paths using CMake’s file(TO_CMAKE_PATH)
to ensure environment variables are interpreted correctly on CMake v4.0+ and updates the CRT file globbing to use the normalized paths.
- Normalize
VCToolsRedistDir
andExtensionSdkDir
withfile(TO_CMAKE_PATH)
- Update
file(GLOB_RECURSE ...)
patterns to reference the new normalized variables
Comments suppressed due to low confidence (1)
src/native/corehost/test/ijw/CMakeLists.txt:16
- Consider adding a check to ensure $ENV{VCToolsRedistDir} is defined (e.g.,
if(NOT DEFINED ENV{VCToolsRedistDir}) ...
) before callingfile(TO_CMAKE_PATH)
to fail early if the environment variable is missing.
file(TO_CMAKE_PATH "$ENV{VCToolsRedistDir}" CMAKE_VS_VCTOOLSREDISTDIR)
# Copy over the debug CRT so that it is available for test runs | ||
file(TO_CMAKE_PATH "$ENV{VCToolsRedistDir}" CMAKE_VS_VCTOOLSREDISTDIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Add a brief comment explaining that file(TO_CMAKE_PATH)
is used to normalize Windows paths (transform backslashes to forward slashes) for compatibility with CMake 4.0+.
# Copy over the debug CRT so that it is available for test runs | |
file(TO_CMAKE_PATH "$ENV{VCToolsRedistDir}" CMAKE_VS_VCTOOLSREDISTDIR) | |
# Copy over the debug CRT so that it is available for test runs | |
# Normalize the Windows path (transform backslashes to forward slashes) for compatibility with CMake 4.0+ | |
file(TO_CMAKE_PATH "$ENV{VCToolsRedistDir}" CMAKE_VS_VCTOOLSREDISTDIR) | |
# Normalize the Windows path (transform backslashes to forward slashes) for compatibility with CMake 4.0+ |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This was broken yesterday in #114187
On some versions of CMake (potentially just v4.0.0 and later) the install will fail as
C:\Program Files
is interpreted as containing an escape character\P
which is unrecognized.