diff --git a/beluga/CMakeLists.txt b/beluga/CMakeLists.txt index 5c08a6422..f2b65b51d 100644 --- a/beluga/CMakeLists.txt +++ b/beluga/CMakeLists.txt @@ -49,7 +49,7 @@ endif() find_package(Eigen3 REQUIRED NO_MODULE) find_package(HDF5 COMPONENTS CXX) find_package(range-v3 REQUIRED) -find_package(Sophus REQUIRED) +include(cmake/LoadSophusTarget.cmake) # Find package with Eigen5 support find_package(TBB REQUIRED) set(_deps @@ -118,6 +118,8 @@ install( NAMESPACE ${PROJECT_NAME}:: DESTINATION ${INSTALL_CMAKEDIR}) +install(FILES cmake/LoadSophusTarget.cmake DESTINATION ${INSTALL_CMAKEDIR}) + include(CMakePackageConfigHelpers) configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in diff --git a/beluga/cmake/Config.cmake.in b/beluga/cmake/Config.cmake.in index 8d7b0e44f..619fdd447 100644 --- a/beluga/cmake/Config.cmake.in +++ b/beluga/cmake/Config.cmake.in @@ -4,7 +4,7 @@ include(CMakeFindDependencyMacro) find_dependency(Eigen3 REQUIRED NO_MODULE) find_dependency(range-v3 REQUIRED) find_dependency(HDF5 COMPONENTS CXX REQUIRED) -find_dependency(Sophus REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/LoadSophusTarget.cmake") # Find package with Eigen5 support find_dependency(TBB REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/beluga/cmake/LoadSophusTarget.cmake b/beluga/cmake/LoadSophusTarget.cmake new file mode 100644 index 000000000..178d0b0bb --- /dev/null +++ b/beluga/cmake/LoadSophusTarget.cmake @@ -0,0 +1,25 @@ +# Copyright 2026 Ekumen, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file can be removed after https://github.com/strasdat/Sophus/pull/558 + +if(NOT TARGET Sophus::Sophus) + find_path( + Sophus_CMAKE_DIR + NAMES SophusTargets.cmake + PATH_SUFFIXES share/sophus/cmake REQUIRED) + find_package(Ceres REQUIRED) + find_package(fmt REQUIRED) + include("${Sophus_CMAKE_DIR}/SophusTargets.cmake") +endif()