I can't see anything in the CMake docs which seems to facilitate this, but I was wondering if there's any way to test whether a target is defined inside a generator expression? What I'd like to be able to do is something like this:
target_compile_definitions(bar PUBLIC $<STREQUAL:$<TARGET_EXISTS:foo>:HAVE_FOO>) This would open up the possibility of setting build flags, etc. depending on things defined later in the CMakeLists.txt file. For a good example of the sort of problem it might solve, have a look at the following question on StackOverflow: http://stackoverflow.com/questions/32766151/check-for-optionally-targets-in-cmake-that-are-not-in-the-correct-order -- Craig Scott Melbourne, Australia http://crascit.com
-- 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