Stephen Kelly <[email protected]> writes: > Philipp Möller wrote: >> It would be great, if I could export imported targets and if CMake could >> walk the dependency tree automatically and import those targets on an >> as-needed basis. > > Part of the problem is that the place where you import your dependent > targets from (and the locations calculated) are not necessarily the same for > your downstreams.
I understand the issue and have been fighting it in versions prior 3.0 as well. It also arises if you simply export targets that have been target_link_librarie'd against full library paths returned by a find_package. That's why I thought some build-in functionality could be helpful for this, e.g. exporting and imported target would lead to a definition in the exports file that automatically triggers a corresponding find_package call. > You export your targets to and -exports file, and presumably you import that > in a -config file. In the same config file, you should add code to find your > dependencies too. > > > http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#creating-packages > > The find_dependency macro can help with forwarding some find_package > arguments. > > http://www.cmake.org/cmake/help/v3.0/module/CMakeFindDependencyMacro.html The documentation is a little sparse, but I think I understand the purpose. I still need to traverse IMPORTED_LINK_INTERFACE_LIBRARIES and figure out which of the list members constitutes a target that needs to trigger a find_dependency and what a full library path is, correct? I can also not rely on a find_package call to actually produce imported targets and need to ship the code that turns the results of find_package in targets. Thanks for your help, Philipp -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
