I want to install RTABMap with vcpkg and then use VSCode as editor to include RTABMap into my C++ project. I installed RTABMap as described on their wiki with vcpkg install rtabmap:x64-windows
(i also tried the x86 triplet) and then wanted to use it in my project. To get started I wrote the following cmake file based on an example from their repository:
cmake_minimum_required(VERSION 3.5)
project(RTABMap_Test VERSION 0.1.0)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
find_package(RTABMap REQUIRED)
find_package(OpenCV REQUIRED)
set(INCLUDE_DIRS
${RTABMap_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
set(LIBRARIES
${RTABMap_LIBRARIES}
${OpenCV_LIBRARIES}
)
include_directories(${INCLUDE_DIRS})
add_executable(RTABMap_Test main.cpp)
target_link_libraries(RTABMap_Test ${LIBRARIES})
and the following main.cpp file:
#include <rtabmap/core/Rtabmap.h>
int main(void) {
return 0;
}
The cmake settings in VSCode are as follows:
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "G:/.vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows"
}
However, when I run CMake: Build
from VSCode, cmake fails with the following message:
-- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044. -- The C compiler identification is MSVC 19.32.31332.0 -- The CXX compiler identification is MSVC 19.32.31332.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at G:/.vcpkg/installed/x64-windows/share/rtabmap/RTABMapConfig.cmake:78 (MESSAGE): Asked for "gui" module but RTABMap hasn't been built with gui support. Call Stack (most recent call first): G:/.vcpkg/scripts/buildsystems/vcpkg.cmake:843 (_find_package) CMakeLists.txt:6 (find_package)
-- Found RTABMap: RTABMap_CORE_RELEASE-NOTFOUND;RTABMap_UTILITE_RELEASE-NOTFOUND;optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib
-- Found Protobuf: G:/.vcpkg/installed/x64-windows/tools/protobuf/protoc.exe (found version "3.21.12.0") -- Looking for pthread.h -- Looking for pthread.h - not found -- Found Threads: TRUE
-- Found TIFF: optimized;G:/.vcpkg/installed/x64-windows/lib/tiff.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/tiffd.lib (found version "4.5.0")
-- Found HDF5: hdf5::hdf5-shared (found version "1.12.2")
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.13", minimum required is "1") -- Found JPEG: optimized;G:/.vcpkg/installed/x64-windows/lib/jpeg.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/jpeg.lib (found version "62") -- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.13") -- Found PNG: optimized;G:/.vcpkg/installed/x64-windows/lib/libpng16.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/libpng16d.lib (found version "1.6.39") -- Found GIF: optimized;G:/.vcpkg/installed/x64-windows/lib/gif.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/gif.lib (found version "5.2.1") -- Found LibArchive: G:/.vcpkg/installed/x64-windows/debug/lib/archive.lib (found version "3.6.2") -- Found OpenCV: G:/.vcpkg/installed/x64-windows (found version "4.7.0") -- Configuring done CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: RTABMap_CORE_RELEASE linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test RTABMap_UTILITE_RELEASE linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.
On the other hand, when I run cmake . -DCMAKE_TOOLCHAIN_FILE=G:/.vcpkg/scripts/buildsystems/vcpkg.cmake
I get this error:
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044. CMake Warning at G:/.vcpkg/installed/x64-windows/share/rtabmap/RTABMapConfig.cmake:78 (MESSAGE): Asked for "gui" module but RTABMap hasn't been built with gui support. Call Stack (most recent call first): G:/.vcpkg/scripts/buildsystems/vcpkg.cmake:843 (_find_package) CMakeLists.txt:6 (find_package)
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.13", minimum required is "1") -- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.13") -- Configuring done CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: RTABMap_CORE_RELEASE linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test RTABMap_UTILITE_RELEASE linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test
-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.
The two missing variables are set in the RTABMapConfig.cmake.in
located at the root directory of the RTABMap repository and used by the CMakeLists.txt
, so I assume that I don't have to set them manually, meaning -- as far as I can tell -- when vcpkg installs RTABMap it doesn't properly configure RTABMap.
What to do?