mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 21:37:11 +00:00
FASTBuild: Fix chaining of library links through sonames
For a shared library with VERSION and SOVERSION, FASTBuild pointed both the namelink and the soname link directly at the real file. Instead, chain the namelink through the soname link, like the other generators do. Fixes: #28153
This commit is contained in:
1 parent
d03477be3e
commit
20c46448e1
3 files changed
+35
-1
No files matched your search
@@ -2486,7 +2486,13 @@ cmFastbuildNormalTargetGenerator::GetSymlinkExecs() const
|
||||
this->ConvertToFastbuildPath(postBuildExecNode.ExecOutput)));
|
||||
res.emplace_back(std::move(postBuildExecNode));
|
||||
};
|
||||
generateSymlinkCommand(targetNames.Real, targetNames.Output);
|
||||
// name -> soname -> realname
|
||||
std::string const& outputLinkTarget =
|
||||
(targetNames.SharedObject.empty() ||
|
||||
targetNames.SharedObject == targetNames.Output)
|
||||
? targetNames.Real
|
||||
: targetNames.SharedObject;
|
||||
generateSymlinkCommand(outputLinkTarget, targetNames.Output);
|
||||
generateSymlinkCommand(targetNames.Real, targetNames.SharedObject);
|
||||
generateSymlinkCommand(targetNames.ImportReal, targetNames.ImportOutput);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,22 @@ in directory:
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Function called in *-check.cmake scripts to check that an installed
|
||||
# symlink points to the expected file.
|
||||
function(check_namelink link expect)
|
||||
set(path "${CMAKE_INSTALL_PREFIX}/${link}")
|
||||
if(NOT IS_SYMLINK "${path}")
|
||||
string(APPEND RunCMake_TEST_FAILED "${link} is not a symlink.\n")
|
||||
else()
|
||||
file(READ_SYMLINK "${path}" actual)
|
||||
if(NOT actual STREQUAL expect)
|
||||
string(APPEND RunCMake_TEST_FAILED
|
||||
"${link} points to ${actual}, expected ${expect}.\n")
|
||||
endif()
|
||||
endif()
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Wrapper for run_cmake() that skips platforms on which we do not support editing the RPATH.
|
||||
function(run_cmake_EDIT_RPATH_only case)
|
||||
if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT MATCHES "^(ELF|XCOFF)$")
|
||||
|
||||
@@ -81,3 +81,15 @@ else()
|
||||
endif()
|
||||
|
||||
check_installed("^${_check_files}$")
|
||||
|
||||
if(APPLE)
|
||||
foreach(name IN ITEMS sep same uns uns-dev)
|
||||
check_namelink(lib/libnamelink-${name}.dylib libnamelink-${name}.1.dylib)
|
||||
check_namelink(lib/libnamelink-${name}.1.dylib libnamelink-${name}.1.0.dylib)
|
||||
endforeach()
|
||||
elseif(NOT WIN32 AND NOT MSYS AND NOT CYGWIN AND NOT NO_NAMELINK)
|
||||
foreach(name IN ITEMS sep same uns uns-dev)
|
||||
check_namelink(lib/libnamelink-${name}.so libnamelink-${name}.so.1)
|
||||
check_namelink(lib/libnamelink-${name}.so.1 libnamelink-${name}.so.1.0)
|
||||
endforeach()
|
||||
endif()
|
||||
Reference in new issue
Block a user