[cmake-developers] Question about ALIAS targets
Stephen Kelly
steveire at gmail.com
Mon Jun 5 17:39:14 EDT 2017
David Cole via cmake-developers wrote:
> Is there a good reason why this error must be an error?
>
> CMake Error at CMakeLists.txt:23 (add_library):
> add_library cannot create ALIAS target "MyProj::gtest" because
> target "OtherProj::googletest" is IMPORTED.
>
> The line of code is:
>
> add_library(MyProj::gtest ALIAS OtherProj::googletest)
>
> Why is there any restriction on ALIAS targets about what sorts of
> targets they may be aliases of?
They were introduced here:
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=370bf554151a1
Aside from the information there, other commits may have extended or tweaked
the features/restrictions.
> After my find_package(OtherProj) call, which is a super build which
> defines lots of imported targets, I want the target to be named gtest
> to match its library name, but OtherProj has named it googletest.
Why isn't there a standard name? Should upstream provide the imported
target? Has any effort been made to make upstream provide it? Is the name
from OtherProj namespaced? Why do you need it to have a particular name? Why
does OtherProj expose it? Should it expose that target for you to use (it
seems an internal thing to me)?
Thanks,
Steve.
More information about the cmake-developers
mailing list