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)