[cmake-developers] EXPORT dependency handling

Brad King brad.king at kitware.com
Wed Jan 20 14:05:35 EST 2016


On 01/20/2016 11:57 AM, rleigh at codelibre.net wrote:
> As an aside, I've found some limitations in the usability and utility of
> EXPORT.  These are two of the missing pieces for making the exported
> configuration functional:
> 
> 1) is the need to manually call find_dependency for each of the interface
> libraries being exported.  I work around this with wrapper scripts, for
> example:
> 
>   https://github.com/openmicroscopy/bioformats/blob/develop/cpp/lib/ome/bioformats/OMEBioFormatsConfig.cmake
> 
> Here we find our dependencies, then include the generated configuration. 
> The thing is, this is a duplication of our requirements from when we
> called find_package for each of those dependencies.  If cmake could store
> a mapping from imported name to the FindXXX file which created it, this
> could also be automatically embedded in the exported file; it could even
> include the minimum version we need.  And it also means the dependencies
> can never become inconsistent as we change them.

The difficulty of this problem is why we defer responsibility to project
code to provide the imported targets for dependencies of exported targets.
There are so many ways of making imported targets available I don't think
it can be solved in general, but perhaps it can be made to work in common
cases (at least optionally) with some kind of mapping as you propose.

> 2) the need to create the interface library target.

I don't understand what you're saying here.  What interface library target
needs to be created in what context?  Please provide an example.

Thanks,
-Brad



More information about the cmake-developers mailing list