视觉SLAM g2o 显示Could not find a package configuration file provided by “G2O” with any of the following names: 解决办法
CmakeList 文件内容 写法
cmake_minimum_required(VERSION 3.17)
project(g2oCurveFitting)
set(CMAKE_CXX_STANDARD 14)
list( APPEND CMAKE_MODULE_PATH /home/tangxiangshi/tools/g2o/cmake_modules )
set(G2O_ROOT /usr/local/include/g2o)
include_directories("/usr/include/eigen3")
find_package(G2O REQUIRED) # G2O REQUIRED is wrong G2O is OK
find_package( OpenCV REQUIRED )
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${G2O_INCLUDE_DIRS})
add_executable(g2oCurveFitting main.cpp)
target_link_libraries(g2oCurveFitting ${OpenCV_LIBS})
target_link_libraries(g2oCurveFitting ${G2O_CORE_LIBRARY} ${G2O_STUFF_LIBRARY})
错误可能的原因:
- 没有添加,下述list, set相关配置