From b030469650099e199b754ca2d805d7a30c343b7d Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Wed, 5 Jun 2024 20:01:32 +0000 Subject: [PATCH] Add a dependency on ceres. There is a dependency on ceres for downstream consumers of sophus, so make sure to add it as an interface depend. Also add it to the package.xml. Signed-off-by: Chris Lalancette --- CMakeLists.txt | 6 ++++++ SophusConfig.cmake.in | 1 + package.xml | 1 + 3 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 433b76e8c..1bc5f1cf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,9 @@ if(NOT TARGET fmt::fmt) find_package(fmt) endif() +if(NOT TARGET Ceres::ceres) + find_package(Ceres REQUIRED) +endif() # Define interface library target add_library(sophus INTERFACE) @@ -121,6 +124,9 @@ else() message(STATUS "Turning basic logging OFF") endif() +target_link_libraries(sophus INTERFACE Ceres::ceres) +set(Ceres_DEPENDENCY "find_dependency (Ceres ${Ceres_VERSION})") + # Associate target with include directory target_include_directories(sophus INTERFACE "$" diff --git a/SophusConfig.cmake.in b/SophusConfig.cmake.in index e8283eda3..8256bf94b 100644 --- a/SophusConfig.cmake.in +++ b/SophusConfig.cmake.in @@ -4,5 +4,6 @@ include (CMakeFindDependencyMacro) @Eigen3_DEPENDENCY@ @fmt_DEPENDENCY@ +@Ceres_DEPENDENCY@ include ("${CMAKE_CURRENT_LIST_DIR}/SophusTargets.cmake") diff --git a/package.xml b/package.xml index 1242b5fe1..6e62299bf 100644 --- a/package.xml +++ b/package.xml @@ -36,6 +36,7 @@ eigen eigen + libceres-dev cmake