[cmake-developers] Alias targets for 2.8.12
Stephen Kelly
steveire at gmail.com
Fri Aug 2 06:04:29 EDT 2013
Brad King wrote:
> The topic looks like a great start. I won't promise to take it
> for 2.8.12 yet but let's proceed with review.
>
> - The documentation in add_library and add_executable lists a bunch
> of things one can't do but not an example of what one can do.
> I think this documentation should have an explicit list of what
> is intended and allowed and then exclude everything else. That
> way if we missed a use case we can treat it as a bug later and
> add the error case.
I'm not sure how to do this one. Do you want an example code snippet of
allowed commands?
>
> - Should add_executable be (dis)allowed to add a library alias,
> and vice-versa for add_library?
Yes, done.
>
> - The documentation does not mention that alias targets cannot be
> installed or exported.
Fixed.
> - Add more "positive" use cases (or "negative" if not allowed)
> to the test suite:
>
> - add_custom_command/add_custom_target COMMAND argv0 translation
> - add_test NAME/COMMAND signature argv0 translation
> - generator expression references e.g. $<TARGET_FILE:...> in
> add_test and add_custom_* commands
> - Alias for an object library with $<TARGET_OBJECTS:...>
All done.
> - Look for other uses of cmMakefile FindTargetToUse and
> FindTarget; all of them need tests for alias behavior and/or
> should be preceded by !IsAlias checks (many are already done).
Reviewed. I think everything is covered.
> - How does this interact with $<TARGET_PROPERTY:NAME>?
The name of the aliased target is returned, not the alias name itself.
>
> - When "if(TARGET xyz)" returns true how can one tell from CMake
> code whether xyz is an alias or a real target? Can one get the
> real target if it is an alias?
I added a ALIASED_TARGET target property for that. An alternative would be
if(ALIAS xyz)
but I don't think that's really needed. if() is complex enough already.
Thanks,
Steve.
More information about the cmake-developers
mailing list