On 08.03.2018 19:50, Alan W. Irwin wrote:
So what are the actual benefits of namespacing the exported targets
associated with libraries?

On the consumer side it makes linking to targets less error prone.

When you link to a library target without a namespace and e.g. get the name or scope wrong CMake will silently assume that you want to link a library by name (e.g. in context of gcc "foo" becomes "-lfoo"). When the library and its headers happens to be in the compiler's standard search directories this might not even get caught at build time right away.

When the library target has a namespace CMake will require the given name to be a target and will fail during generation if the target is not actually available.

Nils
--

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to