Brad King escreveu:
> Really?  That isn't intended, and I can't reproduce it.  Can you provide
> an example of this?

Sorry Brad, I did a more thoughtful test and cmake works according to
the documentation. In my previous test cmake was referencing directly
the library in /usr/lib instead of (wrongly) referring the imported
library pointing to it, which led me to the wrong conclusion. Again,
sorry for the noise.

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

Yes, it makes sense in this scenario. What I'm trying to accomplish is
to use an internally compiled version of ffmpeg in my project if it
isn't already installed on the host system. Since ffmpeg doesn't use
cmake, I've created custom rules that invoke configure and make on it.
Then I'm creating an imported library target pointing to the created
library that gets referenced in other parts of my project. What I liked
in this approach is that the script could first check whether ffmpeg is
already installed and point the imported target to where it is in the
host system. This makes any target dependent on ffmpeg unaware whether
it's using a pre-installed ffmpeg or the bundled one.

Is there a better way to do this?

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

That's not quite my use case here, but it makes sense.

[]s,
rod

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to