Use REALPATH based check for symbolic links on Windows
Windows mount points are marked as symbolic links by CMake. So switch back to the REALPATH based check for Windows hosts. Amends dcc2704d17bda08e6dc7783559ccbfd864dd4339 Task-number: QTBUG-99416 Change-Id: Ic996db1fac5c0b5edc18728535240e272dd435e0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit b13ee89d20013ba4122e5539e9b5a0b65ee3ab6a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
00a1e74522
commit
4f042fafaf
@ -14,21 +14,35 @@ include(.cmake.conf)
|
|||||||
# Bail out if any part of the build directory's path is symlinked.
|
# Bail out if any part of the build directory's path is symlinked.
|
||||||
function(qt_internal_check_if_path_has_symlinks path)
|
function(qt_internal_check_if_path_has_symlinks path)
|
||||||
get_filename_component(dir "${path}" ABSOLUTE)
|
get_filename_component(dir "${path}" ABSOLUTE)
|
||||||
while(TRUE)
|
set(is_symlink FALSE)
|
||||||
if(IS_SYMLINK "${dir}")
|
if(CMAKE_HOST_WIN32)
|
||||||
message(FATAL_ERROR "The path \"${path}\" contains symlinks. \
|
# CMake marks Windows mount points as symbolic links, so use simplified REALPATH check
|
||||||
This is not supported. Possible solutions:
|
# on Windows platforms instead of IS_SYMLINK.
|
||||||
- map directories using a transparent mechanism such as mount --bind
|
get_filename_component(dir_realpath "${dir}" REALPATH)
|
||||||
- pass the real path of the build directory to CMake, e.g. using \
|
if(NOT dir STREQUAL dir_realpath)
|
||||||
cd $(realpath <path>) before invoking cmake <source_dir>.")
|
set(is_symlink TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
while(TRUE)
|
||||||
|
if(IS_SYMLINK "${dir}")
|
||||||
|
set(is_symlink TRUE)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(prev_dir "${dir}")
|
set(prev_dir "${dir}")
|
||||||
get_filename_component(dir "${dir}" DIRECTORY)
|
get_filename_component(dir "${dir}" DIRECTORY)
|
||||||
if("${dir}" STREQUAL "${prev_dir}")
|
if("${dir}" STREQUAL "${prev_dir}")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
endif()
|
||||||
|
if(is_symlink)
|
||||||
|
message(FATAL_ERROR "The path \"${path}\" contains symlinks. \
|
||||||
|
This is not supported. Possible solutions:
|
||||||
|
- map directories using a transparent mechanism such as mount --bind
|
||||||
|
- pass the real path of the build directory to CMake, e.g. using \
|
||||||
|
cd $(realpath <path>) before invoking cmake <source_dir>.")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
qt_internal_check_if_path_has_symlinks("${CMAKE_BINARY_DIR}")
|
qt_internal_check_if_path_has_symlinks("${CMAKE_BINARY_DIR}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user