[cmake-developers] Local target aliases

Brad King brad.king at kitware.com
Mon Dec 12 10:37:27 EST 2016


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



More information about the cmake-developers mailing list