[cmake-developers] Local target aliases

Egor Pugin egor.pugin at gmail.com
Mon Dec 12 11:35:31 EST 2016


So, the original proposal is to make ALIAS & OBJECT targets local. And
explicit GLOBAL keyword will make them global again.

On 12 December 2016 at 18:37, Brad King <brad.king at kitware.com> wrote:
> On 12/10/2016 04:13 PM, Egor Pugin wrote:
>> Is it possible to add GLOBAL option as for INTERFACE/IMPORTED targets (lib/exe)?
>
> The GLOBAL option is only available with an IMPORTED target:
>
>  https://cmake.org/cmake/help/v3.7/command/add_library.html#imported-libraries
>
> Non-imported targets are always globally visible.
>
>> For consistency it's also possible to add GLOBAL for OBJECT libs.
>
> OBJECT libraries are non-imported and therefore already GLOBAL.
>
>> Goal is to not interfere with same alias names in other dirs.
>
> The purpose of ALIAS targets is to allow in-project code to access a
> non-imported target through the same name as external code might access
> that target when it is imported.  Since non-imported targets are always
> globally visible their names are not allowed to conflict anyway.
>
> -Brad
>



-- 
Egor Pugin


More information about the cmake-developers mailing list