Skip to content

Commit

Permalink
Ensure orocos-kdl is available as a target (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Jun 21, 2022
1 parent 1104803 commit 06c1aab
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions orocos_kdl_vendor/orocos_kdl_vendor-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 06c1aab

Please sign in to comment.