[cmake-developers] Allow ALIAS of IMPORTED targets
Stephen Kelly
steveire at gmail.com
Tue Sep 15 13:36:54 EDT 2015
Tamás Kenéz wrote:
>> For example, if an ALIAS can be IMPORTED, does it makes sense that it can
> be
>> exported with export() and install(EXPORT)?
>
> Yes: couple of months ago I was adding install(EXPORT) to an existing
> CMakeList. The name of the library target which I had to export was not
> correct as export target name but I was not able change the library target
> name because of backward compatibility. Being able to export an alias
> would have helped.
I still think exporting should be a follow up to allowing IMPORTED ALIAS.
Just too keep the branch and discussion as short as possible.
Nevertheless, I think you wouldn't need ALIAS targets for your use-case.
They are more than you need. You don't need the aliases anywhere except for
exporting. So, we could design something which allows you to export aliases,
but be completely separate from ALIAS targets.
For example,
add_library(foo ${foo_SRCS})
set_target_property(foo EXPORT_NAMES foo foo_old_name)
...
install(EXPORT ...)
resulting in a generated file containing
add_library(foo IMPORTED)
...
add_library(foo_old_name IMPORTED)
...
where each of the generated targets get the same target properties.
Note that there is already an EXPORT_NAME target property
http://www.cmake.org/cmake/help/v3.3/prop_tgt/EXPORT_NAME.html
but it is not a list, so the task would probably be to deprecate that one
and add EXPORT_NAMES.
I filed
http://public.kitware.com/Bug/view.php?id=15745
Thanks,
Steve.
More information about the cmake-developers
mailing list