On Wednesday, 16. October 2013, 19:45:32, Alexander Neundorf wrote: > On Tuesday 15 October 2013, Johannes Zarl wrote: > > I'd like to make some code in my build system dependent on the existance > > of a target. Basically I'd like to write something like this: > > > > if(TARGET optional_lib) > > > > add_library(bar ${bar_srcs}) > > target_link_library(bar optional_lib) > > > > endif() > > > Can generator expressions maybe be used for that ? > They are evaluated at generate time, so at a time when the target is know > to exist or not.
Yes, that should probably work for my use case. I hadn't thought of that. Thanks! Johannes -- 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://www.cmake.org/mailman/listinfo/cmake