[cmake-developers] Exporting dependent library targets in multiple export sets

Daniel Pfeifer daniel at pfeifer-mail.de
Thu Aug 23 01:28:02 EDT 2012


2012/8/22 Yury G. Kudryashov <urkud.urkud at gmail.com>:
> 2012/8/23 Brad King <brad.king at kitware.com>:
>> On 08/22/2012 04:57 PM, Yury G. Kudryashov wrote:
>>> I'm going to push the current state of my work to
>>> git pull git://gitorious.org/~urkud1/cmake/urkud-cmake.git w/export-set
>>> in a few minutes.
>>
>> Thanks for working on this!
>>
>>> It should work, though I haven't tested it yet. The idea is simple:
>>> each target remembers the latest
>>> install(TARGETS ... EXPORT)
>>> command, and each export set remembers teh latest
>>> install(EXPORT MyExport)
>>> command. Then we query this information.
>>
>> Any "latest install" strategy is bound to generate subtle problems.
>> Dependencies among export sets should be explicit:
>>
>>   install(EXPORT MyExport DEPENDS YourExport)
> How should I choose between different
> install(EXPORT YourExport)
> commands?

What about:

  install(EXPORT MyExport DEPENDS YourPackage1 YourPackage2)

? That could create:

  if(NOT __MyExport_include_guard)
    set(__MyExport_included TRUE)
    find_package(YourPackage1)
    find_package(YourPackage2)
  endif()

before declaring the imported targets.
That way, we get the package dependencies resolved transitively.

Cheers, Daniel



More information about the cmake-developers mailing list