[cmake-developers] Exported targets with imported dependencies in CMake 3.0

Stephen Kelly steveire at gmail.com
Thu Mar 6 09:09:05 EST 2014


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.

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

Thanks,

Steve.





More information about the cmake-developers mailing list