mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-28 01:51:02 -06:00
This was accidentally dropped by commit 622596c6b2 (cmSystemTools:
Re-implement ToNormalizedPathOnDisk without translation map, 2024-10-30,
v4.0.0-rc1~528^2~5). Previously it was done by `CollapseFullPath`.
`cm::PathResolver` intentionally does not expand `~` because it makes
sense only for transforming input paths. Teach `ToNormalizedPathOnDisk`
to handle it directly.
Fixes: #26827
22 lines
811 B
CMake
22 lines
811 B
CMake
if(NOT "$ENV{HOME}" STREQUAL "")
|
|
if(TILDE_PATH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_PATH}")
|
|
message(SEND_ERROR "~ not expanded as expected:\n ${TILDE_PATH}")
|
|
endif()
|
|
|
|
if(TILDE_SLASH_PATH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_SLASH_PATH}" OR NOT TILDE_SLASH_PATH MATCHES "/InHome$")
|
|
message(SEND_ERROR "~/ not expanded as expected:\n ${TILDE_SLASH_PATH}")
|
|
endif()
|
|
else()
|
|
set(ENV{HOME} "${CMAKE_CURRENT_LIST_DIR}")
|
|
endif()
|
|
|
|
set(TILDE "" CACHE PATH "")
|
|
if(TILDE MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE}")
|
|
message(SEND_ERROR "~ not expanded as expected:\n ${TILDE}")
|
|
endif()
|
|
|
|
set(TILDE_SLASH "" CACHE PATH "")
|
|
if(TILDE_SLASH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_SLASH}" OR NOT TILDE_SLASH MATCHES "/InHome$")
|
|
message(SEND_ERROR "~/ not expanded as expected:\n ${TILDE_SLASH}")
|
|
endif()
|