mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Tests/RunCMake/CommandLine: Check tilde shell expansion more precisely
Revise the test from commit 01f92efeb0 (Restore expansion of leading '~'
as home directory in input paths, 2025-04-02, v4.0.1~12^2) to tolerate
`~` in the path to CMake's source or build tree. If tilde `~` shell
expansion fails it can only occur at the beginning of a path component.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
if(NOT "$ENV{HOME}" STREQUAL "")
|
||||
if(TILDE_PATH MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE_PATH}")
|
||||
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$")
|
||||
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()
|
||||
@@ -11,11 +11,11 @@ else()
|
||||
endif()
|
||||
|
||||
set(TILDE "" CACHE PATH "")
|
||||
if(TILDE MATCHES "~" OR NOT IS_ABSOLUTE "${TILDE}")
|
||||
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$")
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user