mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 13:19:51 -05:00
Introduce CMAKE_STAGING_PREFIX variable.
This variable can be useful in cross-compiling contexts where the sysroot is read-only or where the sysroot should otherwise remain pristine. If the new CMAKE_STAGING_PREFIX variable is set, it is used instead of CMAKE_INSTALL_PREFIX when generating the installation rules in cmake_install.cmake. This way, the CMAKE_INSTALL_PREFIX variable always refers to the installation prefix on the target device, regardless of whether host==target. If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX, the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX. Matching paths in the -rpath-link are not transformed. The cross-prefix usr-move workaround is assumed not to require extension regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX is still used to determine the workaround path, and that variable remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the generated export files are deployed to the target, the workaround will still be in place, and still be employed if required.
This commit is contained in:
@@ -43,6 +43,12 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
|
||||
# Project install destination.
|
||||
"${CMAKE_INSTALL_PREFIX}"
|
||||
)
|
||||
if(CMAKE_STAGING_PREFIX)
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||
# User-supplied staging prefix.
|
||||
"${CMAKE_STAGING_PREFIX}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# List common include file locations not under the common prefixes.
|
||||
|
||||
@@ -79,6 +79,12 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
|
||||
# Project install destination.
|
||||
"${CMAKE_INSTALL_PREFIX}"
|
||||
)
|
||||
if (CMAKE_STAGING_PREFIX)
|
||||
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
|
||||
# User-supplied staging prefix.
|
||||
"${CMAKE_STAGING_PREFIX}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
|
||||
@@ -94,6 +100,11 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
|
||||
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
||||
"${CMAKE_INSTALL_PREFIX}/bin"
|
||||
)
|
||||
if (CMAKE_STAGING_PREFIX)
|
||||
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
||||
"${CMAKE_STAGING_PREFIX}/bin"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
|
||||
"${_CMAKE_INSTALL_DIR}/bin"
|
||||
|
||||
Reference in New Issue
Block a user