Skip to content

Commit

Permalink
add Eigen3 CMake target workaround to other RCT packages
Browse files Browse the repository at this point in the history
  • Loading branch information
schornakj committed Jun 24, 2020
1 parent bb148ca commit 42167d3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
9 changes: 9 additions & 0 deletions rct_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ find_package(Eigen3 REQUIRED)
if(NOT EIGEN3_INCLUDE_DIRS)
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
if(NOT TARGET Eigen3::Eigen)
find_package(Threads REQUIRED)
add_library(Eigen3::Eigen IMPORTED INTERFACE)
set_target_properties (Eigen3::Eigen PROPERTIES
EXPORT_NAME Eigen
INTERFACE_COMPILE_DEFINITIONS ${EIGEN3_DEFINITIONS}
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIRS}
)
endif()

# This package only provides examples. It does not export any tools.
catkin_package()
Expand Down
11 changes: 3 additions & 8 deletions rct_image_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ find_package(yaml-cpp REQUIRED)
find_package(rct_common REQUIRED)
find_package(rct_optimizations REQUIRED)

find_package(Eigen3 REQUIRED NO_MODULE)
find_package(Eigen3 REQUIRED)
if(NOT TARGET Eigen3::Eigen)
find_package(Threads REQUIRED)
add_library(eigen IMPORTED INTERFACE)
set_target_properties (eigen PROPERTIES
add_library(Eigen3::Eigen IMPORTED INTERFACE)
set_target_properties (Eigen3::Eigen PROPERTIES
EXPORT_NAME Eigen
INTERFACE_COMPILE_DEFINITIONS ${EIGEN3_DEFINITIONS}
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIRS}
)

install(TARGETS eigen EXPORT Eigen3Targets)
export(TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake)
install(EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})

endif()

add_library(${PROJECT_NAME} SHARED
Expand Down
11 changes: 11 additions & 0 deletions rct_ros_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ find_package(rct_image_tools REQUIRED)

find_package(OpenCV REQUIRED)

find_package(Eigen3 REQUIRED)
if(NOT TARGET Eigen3::Eigen)
find_package(Threads REQUIRED)
add_library(Eigen3::Eigen IMPORTED INTERFACE)
set_target_properties (Eigen3::Eigen PROPERTIES
EXPORT_NAME Eigen
INTERFACE_COMPILE_DEFINITIONS ${EIGEN3_DEFINITIONS}
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIRS}
)
endif()

find_package(catkin REQUIRED COMPONENTS
roscpp

Expand Down

0 comments on commit 42167d3

Please sign in to comment.