> On Oct 5, 2017, at 3:50 AM, Nagy-Egri Máté Ferenc <csiga.b...@aol.com> wrote: > > Hi Michael! > > This is what I wanted to do (only relevant parts showing): > > /// top-level CMakeLists.txt > add_subdirectory(Gripper) > add_subdirectory(examples) > > > /// Gripper/CmakeLists.txt > set(RESULT ${CMAKE_CURRENT_BINARY_DIR}/inc/Gripper/stl/stlYlms_dynamic.hpp) > add_custom_command(COMMAND ... ARGS ... > OUTPUT ${RESULT}) > add_custom_target(Ylms > DEPENDS ${RESULT}) > > # What comes from HERE > add_library(Gripper::Ylms INTERFACE IMPORTED GLOBAL) > target_include_directories(Gripper::Ylms INTERFACE > ${CMAKE_CURRENT_SOURCE_DIR}/inc > > ${CMAKE_CURRENT_BINARY_DIR}/inc) > add_dependencies(Gripper::Ylms Ylms) > # to HERE? (Note, example does not work) > > /// examples/CmakeLists.txt > add_executable(example1 main.cpp) > > target_link_libraries(example1 Gripper::Ylms) > > When specifying Gripper::Ylms as a link target for example1, I would like to > pick up both the dependency of Ylms being processed first and also the > include directory marking the location of the generated header file. > > Note, the closes I got was using > > set_target_properties (Gripper::Ylms PROPERTIES INTERFACE_INCLUDE_DIRECTORIES > "${CMAKE_CURRENT_SOURCE_DIR}/inc ${CMAKE_CURRENT_BINARY_DIR}/inc") > > instead of > > target_include_directories(Gripper::Ylms INTERFACE > ${CMAKE_CURRENT_SOURCE_DIR}/inc > > ${CMAKE_CURRENT_BINARY_DIR}/inc) > > because set_target_properties wouldn’t let me specify multiple entries, but > target_include_directories is not allowed on IMPORTED targets (but simple > INTERFACE libraries cannot be global)… no combination of commands seem to > work. >
I think “IMPORTED” on your header library might be part of the problem…I would remove that. I have an example I will send you privately that does what you want I think… -Mike
signature.asc
Description: Message signed with OpenPGP
-- 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