cmake: symlink_install: detect and properly symlink versioned libraries #1126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: versioned libraries do not end in ".so" but in ".so.X.Y.Z" and require an additional unversioned symlink to help CMake and the linker find it.
Here is a (quite popular) package that uses versioned libraries: https://github.com/ros-planning/moveit_visual_tools/blob/c166f8ee6412023b4183fc091abe6acbcdba2448/CMakeLists.txt#L57
Currently, the
catkin_symlink_install_targets
function will not detect the versioned library (in this caselibmoveit_visual_tools.so.3.6.0
) as a library, copying it to the wrong destination. This PR replaces the simple check for ".so" with a regex that also matches versioned libraries.Furthermore, versioned libraries require an additional symlink from the unversioned name, otherwise CMake and/or the linker won't find the library. CMake's
install(TARGETS)
command seems to do that automatically, so we add logic to do that as well.I didn't find a test case for symlinked installs - if there is one, I'd be happy to add a unit test.