Skip to content

Commit 023e907

Browse files
authored
Fix Ceres inclusion and path export (#422)
* Fix Ceres inclusion and path export Ceres is referenced in fuse header files and the existing way it was being included in fuse_core did not export the include paths for Ceres which breaks downstream packages when they include fuse_core headers. This was only exposed through the per-package builds since the existing merged builds get lucky that all the include dirs are merged together. * Fix typo INCLUDE_DIRS -> LIBRARIES * Harden logic for CERES_INCLUDEDIRS In case INTERFACE_INCLUDE_DIRS isn't a valid property we can revert back to the existing behavior when no include dirs are set. * Keep includes for target_include_directories
1 parent 74b06cb commit 023e907

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

fuse_core/CMakeLists.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,29 @@ find_package(catkin REQUIRED COMPONENTS
1212
)
1313
find_package(Boost REQUIRED COMPONENTS serialization)
1414
find_package(Ceres REQUIRED)
15+
16+
if(TARGET Ceres::ceres)
17+
get_target_property(CERES_INCLUDEDIRS Ceres::ceres INTERFACE_INCLUDE_DIRECTORIES)
18+
19+
if("${CERES_INCLUDEDIRS}" STREQUAL "CERES_INCLUDEDIRS-NOTFOUND")
20+
message(STATUS "Ceres::ceres INTERFACE_INCLUDE_DIRS not found; CERES_INCLUDEDIRS will be empty")
21+
set(CERES_INCLUDEDIRS, "")
22+
else()
23+
message(STATUS "Ceres::ceres INTERFACE_INCLUDE_DIRS: '${CERES_INCLUDEDIRS}'")
24+
endif()
25+
else()
26+
message(WARNING "Ceres::ceres imported target not found; CERES_INCLUDEDIRS will be empty.")
27+
set(CERES_INCLUDEDIRS "")
28+
endif()
29+
1530
find_package(Eigen3 REQUIRED)
1631
find_package(PkgConfig REQUIRED)
1732
pkg_check_modules(libglog REQUIRED)
1833

1934
catkin_package(
2035
INCLUDE_DIRS
2136
include
37+
${CERES_INCLUDEDIRS}
2238
LIBRARIES
2339
${PROJECT_NAME}
2440
CATKIN_DEPENDS
@@ -73,15 +89,17 @@ target_include_directories(${PROJECT_NAME}
7389
SYSTEM PUBLIC
7490
${Boost_INCLUDE_DIRS}
7591
${catkin_INCLUDE_DIRS}
76-
${CERES_INCLUDE_DIRS}
92+
${CERES_INCLUDEDIRS}
7793
${EIGEN3_INCLUDE_DIRS}
7894
${GLOG_INCLUDE_DIRS}
7995
)
8096
target_link_libraries(${PROJECT_NAME}
81-
${Boost_LIBRARIES}
82-
${catkin_LIBRARIES}
83-
${CERES_LIBRARIES}
84-
${GLOG_LIBRARIES}
97+
PUBLIC
98+
Ceres::ceres
99+
${catkin_LIBRARIES}
100+
PRIVATE
101+
${Boost_LIBRARIES}
102+
${GLOG_LIBRARIES}
85103
)
86104
set_target_properties(${PROJECT_NAME}
87105
PROPERTIES

0 commit comments

Comments
 (0)