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

Yury G. Kudryashov urkud.urkud at gmail.com
Thu Aug 23 04:20:44 EDT 2012


Hi!
2012/8/23 Daniel Pfeifer <daniel at pfeifer-mail.de>:
> 2012/8/22 Yury G. Kudryashov <urkud.urkud at gmail.com>:
>>> 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.

This does not solve the problem of resolving namespaces.

What do you think about the following algorithm:

1. Export set lookup
1a. Look in the current export set.
1b. If failed, look in the export sets listed in DEPENDS parameter.
1c. If failed, look if the target belongs to a unique export set.
1d. If failed, produce an error message.

2. Installation of an export set lookup.
2a. For the current export set, use the current installation.
2b. For dependencies, if an export set was not installed or was
installed more than once, fail; otherwise, use the unique
installation.

Some questions:
1. What should we do in the APPEND mode?
2. Should we include(/path/to/dependency)? Or find_package() as
suggested by Daniel?
2a. If yes, using relative or absolute path?
-- 
Yours Yury,
mailto: urkud.urkud at gmail.com



More information about the cmake-developers mailing list