From d29d96a09e9b0f2a7e5966795623228429c5fd2b Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sun, 12 Jul 2026 20:06:07 -0700 Subject: [PATCH] pinning opencv for downstream apps --- CMakeLists.txt | 3 +++ RTABMapConfig.cmake.in | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2df667fa..5e0a184d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1347,6 +1347,9 @@ ELSE() ENDIF() STRING(REPLACE ";" " " CONF_OPENCV_COMPONENTS "${CONF_OPENCV_COMPONENTS}") STRING(REPLACE ";" " " CONF_OPENCV_OPTIONAL_COMPONENTS "${CONF_OPENCV_OPTIONAL_COMPONENTS}") +# Pin the OpenCV major version so downstream projects find the same major RTAB-Map was +# built against +SET(CONF_OPENCV_VERSION_MAJOR ${OpenCV_VERSION_MAJOR}) include(CMakePackageConfigHelpers) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" diff --git a/RTABMapConfig.cmake.in b/RTABMapConfig.cmake.in index 1a3d03cc..713359b4 100644 --- a/RTABMapConfig.cmake.in +++ b/RTABMapConfig.cmake.in @@ -1,7 +1,7 @@ include(CMakeFindDependencyMacro) # Mandatory dependencies -find_dependency(OpenCV COMPONENTS @CONF_OPENCV_COMPONENTS@ OPTIONAL_COMPONENTS @CONF_OPENCV_OPTIONAL_COMPONENTS@) +find_dependency(OpenCV @CONF_OPENCV_VERSION_MAJOR@ COMPONENTS @CONF_OPENCV_COMPONENTS@ OPTIONAL_COMPONENTS @CONF_OPENCV_OPTIONAL_COMPONENTS@) if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/RTABMap_guiTargets.cmake") find_dependency(PCL 1.7 COMPONENTS common io kdtree search surface filters registration sample_consensus segmentation visualization)