diff --git a/orocos_kdl_vendor/orocos_kdl_vendor-extras.cmake b/orocos_kdl_vendor/orocos_kdl_vendor-extras.cmake index 8006fcc..f6f5cd5 100644 --- a/orocos_kdl_vendor/orocos_kdl_vendor-extras.cmake +++ b/orocos_kdl_vendor/orocos_kdl_vendor-extras.cmake @@ -12,15 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +find_package(orocos_kdl REQUIRED) +if(NOT TARGET orocos-kdl) + find_library(orocos_kdl_LIBRARY orocos-kdl REQUIRED) + add_library(orocos-kdl SHARED IMPORTED) + set_target_properties(orocos-kdl PROPERTIES + IMPORTED_LOCATION ${orocos_kdl_LIBRARY} + INTERFACE_LINK_LIBRARIES ${orocos_kdl_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${orocos_kdl_INCLUDE_DIRS}) +endif() + find_package(eigen3_cmake_module REQUIRED) find_package(Eigen3 REQUIRED) -find_package(orocos_kdl REQUIRED) -if(TARGET orocos-kdl) - message(STATUS "Ensuring Eigen3 include directory is part of orocos-kdl CMake target") - if(TARGET Eigen3::Eigen) - # TODO: require target to exist when https://github.com/ros2/choco-packages/issues/19 is addressed - target_link_libraries(orocos-kdl INTERFACE Eigen3::Eigen) - else() - target_include_directories(orocos-kdl SYSTEM INTERFACE ${Eigen3_INCLUDE_DIRS}) - endif() +message(STATUS "Ensuring Eigen3 include directory is part of orocos-kdl CMake target") +if(TARGET Eigen3::Eigen) + # TODO: require target to exist when https://github.com/ros2/choco-packages/issues/19 is addressed + target_link_libraries(orocos-kdl INTERFACE Eigen3::Eigen) +else() + target_include_directories(orocos-kdl SYSTEM INTERFACE ${Eigen3_INCLUDE_DIRS}) endif()