关于g2o编译报错问题


cmake编译时出现一下错误

CMake Error at CMakeLists.txt:11(find_package):
By not providing "FindG2O.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "G2O", but
CMake did not find one.

Could not find a package configuration file provided by "G2O" with any of
the following names:

G2OConfig.cmake
g2o-config.cmake
Add the installation prefix of "G2O" to CMAKE_PREFIX_PATH or set "G2O_DIR"
to a directory containing one of the above files. If "G2O" provides a
separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!

原因:

 cmakelist里面需要额外添加:

LIST( APPEND CMAKE_MODULE_PATH /home/tianbot/Downloads/g2o/cmake_modules )
set(G2O_ROOT /usr/local/include/g2o)

其中"/home/tianbot/Downloads/g2o/cmake_modules"为编译g2o时的文件,所以千万不要删除!

 参考:

https://blog.csdn.net/yunlaowang/article/details/90512976#t8

https://blog.csdn.net/xiangshi777/article/details/113996945