[cmake-developers] Allow ALIAS of IMPORTED targets
CHEVRIER, Marc
marc.chevrier at sap.com
Tue Sep 15 02:57:35 EDT 2015
I completely agree. Seems reasonable to disallow exporting ALIAS targets.
Marc
On 14/09/15 19:34, "cmake-developers on behalf of Stephen Kelly" <cmake-developers-bounces at cmake.org on behalf of steveire at gmail.com> wrote:
>Michael Scott wrote:
>
>> Hi,
>>
>> I'm planning on having a look at the CMake issue "Allow ALIAS of
>> IMPORTED targets", 0015569. After reading the thread between yourself
>> and Marc, I wanted to ask a couple of things before I start going
>> further with it.
>
>Thanks for working on this.
>
>> The proposed change would be for the add_library and add_executable
>> commands only right?
>
>Yes, I guess so.
>
>> Having a quick look at the code for those two commands, they
>> specifically check for a combination of ALIAS and IMPORTED and don't
>> allow it. I'm guessing that the required changes to allow both
>> simultaneously wouldn't be to just remove this check, there would be
>> other areas to modify as well right?
>
>Perhaps. Finding that out is the real task :). I don't have all the answers
>to it. The specific disallowing of ALIAS and IMPORTED together by issuing an
>error was a way to defer finding those answers while not being required to
>maintain compatibility with a particular behavior. I didn't want finding
>those answers to delay getting the ALIAS feature in, because it was useful
>already as it was.
>
>Now, we have time to consider all of the implications of allowing this as
>part of the design.
>
>For example, if an ALIAS can be IMPORTED, does it makes sense that it can be
>exported with export() and install(EXPORT)?
>
>If we have
>
> add_library(CoreStatic ${Core_SRCS})
> add_library(MyNS::Core ALIAS CoreStatic)
>
>and I export both of them with the NAMESPACE 'MyNS::', do I end up with
>
> MyNS::MyNS::Core
>
>?
>
>Or would the exporting code strip of everything before a '::' in the alias
>name?
>
>Or should exporting ALIAS targets still be disallowed?
>
>The two use cases described in
>
> http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/52452
>
>seem like they would not benefit from exporting ALIAS targets.
>
>A reasonable way forward might be:
>
>* Keep the restriction that ALIAS targets may not be exported.
>* Remove the code disallowing ALIAS IMPORTED targets.
>* Remove the unit test proving it is not allowed
>* Add new unit tests that it basically works
>* Add a unit test for using an ALIAS with try_compile(LINK_LIBRARIES)
>* (Anything else that comes up along the way)
>
>Thanks,
>
>Steve.
>
>
>--
>
>Powered by www.kitware.com
>
>Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
>Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
>CMake Support: http://cmake.org/cmake/help/support.html
>CMake Consulting: http://cmake.org/cmake/help/consulting.html
>CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/cmake-developers
More information about the cmake-developers
mailing list