Hi,
in a project, I have to generate some C++ header files at build time.
Targets that use these header files need to know the directory of the
generated files and depend on the custom target that in turn depends
on the generated files. Example:
target_include_directories(lib PRIVATE ${gen_dir})
add_dependency(lib gen_target)
I would like to modernize that to:
target_link_libraries(lib PRIVATE gen_interface)
However, there is afaik no way of combining INTERFACE properties and
custom targets.
I think CMake needs one of the following alternatives:
1. Allow adding target-level dependencies to INTERFACE library:
add_library(interface INTERFACE)
target_include_directories(interface INTERFACE ...)
add_custom_target(custom DEPENDS ...)
add_dependencies(interface custom)
2. Allow INTERFACE properties on custom targets:
add_custom_target(custom DEPENDS ...)
target_include_directories(custom INTERFACE ...)
3. Allow file level dependencies for INTERFACE libraries
add_library(interface INTERFACE DEPENDS ...)
Any of these three solutions satisfies my requirements, option 3 being
my favorite.
A similar question was left unanswered here:
http://public.kitware.com/pipermail/cmake/2014-April/057456.html
cheers, Daniel
--
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