[CMake] Using imported targets with export command
Brad King
brad.king at kitware.com
Thu Jan 15 10:56:15 EST 2009
Rodolfo Schulz de Lima wrote:
> Rodolfo Schulz de Lima escreveu:
>> me. The documentation states that an imported target is visible in the
>> current directory and below. What is the rationale for this behaviour?
>
> After some testing, the documentation is misleading. Actually cmake does
> the right thing, it's possible to reference an imported target outside
> the directory it's created.
Really? That isn't intended, and I can't reproduce it. Can you provide
an example of this?
Imported targets should be scoped as the documentation states. The
reason is that different parts of a project may load the same package or
two different versions of the same package. They should remain isolated
from one another just like variable scopes are isolated.
> What isn't possible is to use an imported library in a export command.
> Why is it so?
An imported target is something that was already installed, so any
project that would see your project's exports could just import it from
the same place you did.
-Brad
More information about the CMake
mailing list