Handling dependencies that are imported libraries #378
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.
Carry over from our email discussion - better having it here.
Problem: sometimes dependencies are provided as import targets. This causes a problem when creating a catkin package's Find... cmake module as it stores the target name which is often different to the actual library name. Packages using this then fail to find the required libraries.
About Imported Libraries
This is a convenience as it lets you use them like a real target. Refer to the cmake documentation and wiki tutorials for more information. Boost's cmake modular build creates files in
lib/Boost.cmake
,lib/Boost-debug.cmake
,boost-1.47.0/cmake/BoostConfig.cmake
andboost-1.47.0/cmake/BoostConfigVersion.cmake
as an example.Use Case
We're using cmake-boost for windows. Note that this isn't specifically a windows problem. It would apply to any xxx-config.cmake files which were written setting found libraries as imported targets.
The above diff handles the problem for windows. I'm not sure about handling the case where you have multiple imported configurations though and how you should choose the configuration you require. This works for boost as each configuration (DEBUG, RELEASE) has only one imported configuration. I don't have any other examples to test on.
This Approach
Simply digs into the imported library property information and dumps the actual library name into the
xxxConfig.cmake
for the package.Other Approaches
I did initially think of recreating the imported targets in the xxxConfig.cmake modules, but this will fail as soon as another package tries to
find_package(Boost...)
again as suddenly there will be twoadd_library(xxx IMPORTED)
calls.