Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling dependencies that are imported libraries #378

Closed
wants to merge 1 commit into from

Conversation

stonier
Copy link
Contributor

@stonier stonier commented Mar 10, 2013

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 and boost-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 two add_library(xxx IMPORTED) calls.

@dirk-thomas
Copy link
Member

The patch looks great - thanks. I will commit a slightly modified version without tabs and trailing whitespaces.

@stonier
Copy link
Contributor Author

stonier commented Mar 13, 2013

Sorry - configuring my editor now to lose the tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants