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

Brad King brad.king at kitware.com
Tue Nov 22 09:49:19 EST 2011


On 11/22/2011 9:31 AM, Stephen Kelly wrote:
>> CMake Error: INSTALL(EXPORT "twoDeps" ...) includes target "libtwo" which
>> requires target "libone" that is not in the export set.
>>
>> How can we resolve this?
>
> http://public.kitware.com/Bug/view.php?id=12588
>
> Brad asked to bring this up on the list for discussion.

Additional CMake development is needed to support this.  We need to
introduce the notion of multiple dependent install(EXPORT) sets.

I think the commands will look something like this:

   add_library(A ...)
   add_library(B ...)
   target_link_libraries(B A)
   install(TARGETS A ... EXPORT ExportA)
   install(TARGETS B ... EXPORT ExportB)
   install(EXPORT ExportA ...)
   install(EXPORT ExportB DEPENDS ExportA ...)

The "DEPENDS ExportA" option to install(EXPORT) on the last line will need to
be added and implemented.  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.  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.

Take a look at cmInstallExportGenerator, cmExportInstallFileGenerator,
and cmGlobalGenerator's ExportSets member.  Some of them will need to be
refactored to allow an export set to refer to other exports sets as
dependencies.  The check in cmExportFileGenerator::SetImportLinkProperty
for availability of a target's dependencies will have to be replaced with
a lookup that follows the export set's dependencies.  If the dependency
belongs to another set, that other set's prefix must be used when referring
to the target.

-Brad


More information about the cmake-developers mailing list