mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
@@ -2266,7 +2266,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
|
||||
// support or if using the link path as an rpath.
|
||||
if (use_build_rpath) {
|
||||
std::string d = ri;
|
||||
if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
|
||||
if (!rootPath.empty() && rootPath != "/" && cmHasPrefix(d, rootPath)) {
|
||||
d.erase(0, rootPath.size());
|
||||
} else if (cmNonempty(stagePath) && cmHasPrefix(d, *stagePath)) {
|
||||
d.erase(0, (*stagePath).size());
|
||||
@@ -2297,7 +2297,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
|
||||
!cmSystemTools::IsSubDirectory(ri, topSourceDir) &&
|
||||
!cmSystemTools::IsSubDirectory(ri, topBinaryDir)) {
|
||||
std::string d = ri;
|
||||
if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
|
||||
if (!rootPath.empty() && rootPath != "/" &&
|
||||
cmHasPrefix(d, rootPath)) {
|
||||
d.erase(0, rootPath.size());
|
||||
} else if (cmNonempty(stagePath) && cmHasPrefix(d, *stagePath)) {
|
||||
d.erase(0, (*stagePath).size());
|
||||
|
||||
@@ -31,6 +31,8 @@ if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
|
||||
run_RuntimePath(Genex)
|
||||
run_cmake_command(GenexCheck
|
||||
${CMAKE_COMMAND} -Ddir=${RunCMake_BINARY_DIR}/Genex-build -P ${RunCMake_SOURCE_DIR}/GenexCheck.cmake)
|
||||
|
||||
run_RuntimePath(SysrootSlash)
|
||||
endif()
|
||||
|
||||
block()
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
enable_language(C)
|
||||
|
||||
# Setting CMAKE_SYSROOT to "/" must not strip the leading "/" from RPATH entries.
|
||||
set(CMAKE_SYSROOT "/")
|
||||
|
||||
function(CheckRpath target rpath)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -Dfile=$<TARGET_FILE:${target}> -Drpath=${rpath}
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/RelativeCheck.cmake"
|
||||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
|
||||
add_library(sysroot-slash-lib SHARED A.c)
|
||||
add_executable(sysroot-slash-exe main.c)
|
||||
target_link_libraries(sysroot-slash-exe sysroot-slash-lib)
|
||||
CheckRpath(sysroot-slash-exe "${CMAKE_CURRENT_BINARY_DIR}${cfg_dir}")
|
||||
Reference in New Issue
Block a user