On 12/12/2016 11:35 AM, Egor Pugin wrote:
> So, the original proposal is to make ALIAS & OBJECT targets local. And
> explicit GLOBAL keyword will make them global again.

An OBJECT library is just like any other target as far as the generated
build system is concerned, so it needs a globally unique name like any
other.  The purpose of ALIAS targets is this:

```
# some/subdir/CMakeLists.txt
add_library(lib1 lib1.cpp)
install(TARGETS lib1 EXPORT lib1Export ${dest_args})
install(EXPORT lib1Export NAMESPACE Upstream:: ${other_args})
add_library(Upstream::lib1 ALIAS lib1)
```

Then other code in the project can use the name `Upstream::lib1` as
if it had imported that target (e.g. for test trees that may build
inside the project or externally).  The other code is not necessarily
in the same directory, so the global visibility of ALIAS targets is
an intentional design decision.  Since the aliased target has a globally
unique name, so would the ALIAS if it is only used to prefix a namespace.

If your trees are so huge or import so many other third-party projects
that name collisions are a problem, then I suggest breaking it down
using ExternalProject.

-Brad
-- 

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

Reply via email to