[cmake-developers] Multiple dependent install(EXPORT) sets

Alexander Neundorf neundorf at kde.org
Tue Nov 22 12:25:21 EST 2011


On Tuesday 22 November 2011, Brad King wrote:
> On 11/22/2011 10:03 AM, Stephen Kelly wrote:
> > Brad King wrote:
> >> We will have to require that the install(EXPORT)
> >> commands be invoked in dependency order (ex. A before B).  That way when
> >> the command installing ExportB is writing library B's dependency on A,
> >> it can transform the name using the options that had been given to the
> >> install command for ExportA, such as its NAMESPACE.
> 
> This is required because ExportB will create an imported target for library
> B and that imported target will list its dependency on an imported target
> for library A.  What is that imported target called?  Where is it defined?
>  Only ExportA knows, and then only after its install(EXPORT) has been
> called.

Yes.

Where/why is it actually necessary to split libraries installed from one 
package into multiple Config.cmake files ?
This is now to install separate libraries from a big kdelibs, right ?
Maybe we (KDE) simply shouldn't do this, and just start with it once the big 
modules are broken into separate parts.
Then each of the smaller parts can install a Config.cmake file for all its 
libraries. If e.g. libkgui depends on libkcore, currently those two targets 
would exist in one project, but installed as two export sets.
Once they are separated into two projects, then libkgui depends already on the 
imported target KDE::kcore (or how it is named), and referencing this in its 
Targets.cmake file works fine.
We do this already with Qt4.
 
> >> Furthermore, the targets file
> >> generated for ExportB will need to include() the file generated for
> >> ExportA using the DESTINATION given to the latter to make its targets
> >> available.
> > 
> > And its FILE presumably, but why? This ties in to the question of whether
> 
> > find_package(B) should find the dependencies of B:
> We could leave this part out and leave it up to the Config.cmake file
> author to ensure ExportA's targets file is loaded when ExportB's targets
> file is loaded.

Yes.

Alex


More information about the cmake-developers mailing list