当前位置:   article > 正文

SLAM14讲错误笔记(第六讲G2O篇)_by not providing "findluagoogle.cmake" in cmake_mo

by not providing "findluagoogle.cmake" in cmake_module_path this project has

错误一:g2oCurveFitting程序cmake报错

报错信息:

  1. CMake Error at CMakeLists.txt:12 (find_package):
  2. By not providing "FindG2O.cmake" in CMAKE_MODULE_PATH this project has
  3. asked CMake to find a package configuration file provided by "G2O", but
  4. CMake did not find one.
  5. Could not find a package configuration file provided by "G2O" with any of
  6. the following names:
  7. G2OConfig.cmake
  8. g2o-config.cmake
  9. Add the installation prefix of "G2O" to CMAKE_PREFIX_PATH or set "G2O_DIR"
  10. to a directory containing one of the above files. If "G2O" provides a
  11. separate development package or SDK, be sure it has been installed.
  12. -- Configuring incomplete, errors occurred!
  13. See also "/home/chi/slambook2/ch6/g2oCurveFitting/build/CMakeFiles/CMakeOutput.log".

错误原因:

        参考了凌啸天zhiwei121等人的博客,原因应该是没有找到相应的库文件所致。

解决方法:

        根据zhiwei121的解决方法,将要保证build文件夹与cmake的文件夹在同一级,在高翔博士的代码中是附有cmake文件的。

        对应的CMakeLists.txt中

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

也要加入自己写的CMakeLists.txt中,cmake ..通过。

注1:按笔者贫瘠的编程知识,这种解决方法更像是通过外挂文件“解决”了库文件索引问题,似乎是治标不治本,凌啸天的处理方法可能更好,这里没有继续尝试了。

注2:根据youxiaogeo的解决方法,直接在CMakeLists.txt文件中添加G2O的库路径也可解决问题,如下所示:

  1. LIST( APPEND CMAKE_MODULE_PATH /XXX/g2o/cmake_modules )
  2. SET( G2O_ROOT /home/xxx/g2o )
  3. FIND_PACKAGE( G2O REQUIRED )

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/292853
推荐阅读
相关标签
  

闽ICP备14008679号