I have a library that needs to be built on some platforms but on others is part 
of the OS.  I'd like to avoid putting "if platform" conditional code in the 
places it is used, but instead hide it away in my platform-specific code.

One way to do this is define a variable mylib_targetname in each platform and 
add ${mylib_targetname} as a dependency.  It can be defined on some platforms 
and undefined on others.

It feels cleaner if I could create an alias target MY_NAMESPACE::mylib and 
refer to that. This lets me define the dependency without making sure an 
environment variable is set, which feels more natural.  But in order to make 
this work I need a way to express that MY_NAMESPACE::mylib might be 
(legitimately) null on some platforms, and I can't figure out how to do this.

Any ideas?

--
Andrew

-- 

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