On 08/23/2012 04:20 AM, Yury G. Kudryashov wrote:
> Hi!
> 2012/8/23 Daniel Pfeifer <dan...@pfeifer-mail.de>:
>> 2012/8/22 Yury G. Kudryashov <urkud.ur...@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?

I don't think we ever considered the possibility of more than one
install(EXPORT) for the same export, only that there could be more
than one install(TARGETS ... EXPORT ...) for the same target but
listing different exports.  I would be okay with warning if there
is more than one install for the same export and making it an error
if the export is a dependency of another export (your algo #2).

> 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.

That looks good, though I'm not excited by 1c.  I'd rather all
DEPENDS be explicit so there are no surprises.  What if I had
intended to put the dependency in my current set but forgot?

> 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.

Yes.

> Some questions:
> 1. What should we do in the APPEND mode?

That does not check dependencies anyway so the project doing that
is on its own.  A better approach is to APPEND to a global property
and then do one export() at the end by querying the global property.

> 2. Should we include(/path/to/dependency)? Or find_package() as
> suggested by Daniel?
> 2a. If yes, using relative or absolute path?

No, at least not yet.  I think Alex's suggestion:

 if(NOT TARGET mydep)
   message(FATAL_ERROR "mydep not found; need ${export_providing_mydep}")
 endif()

is the simplest approach.  The file produced by install(EXPORT)
is not necessarily a package configuration file itself but
should normally be loaded by one.  We do not know what the package
on which we depend will be called.

Normally there will be a package configuration file that loads the
current export.  It is up to that file to ensure that it has loaded
the packages that load the current export's dependencies.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to