描述
我想编译ceres-sover的源码,在vins工程中调用,将include和internal连个文件放到vins包下,然后编译
会报错。
1、编译报错信息
CMake Error at multi-vins-fusion/vins_estimator/CMakeLists.txt:39 (find_package):
By not providing "FindSuiteSparse.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"SuiteSparse", but CMake did not find one.
Could not find a package configuration file provided by "SuiteSparse" with
any of the following names:
SuiteSparseConfig.cmake
suitesparse-config.cmake
Add the installation prefix of "SuiteSparse" to CMAKE_PREFIX_PATH or set
"SuiteSparse_DIR" to a directory containing one of the above files. If
"SuiteSparse" provides a separate development package or SDK, be sure it
has been installed.
或者:
0: fatal error: SuiteSparseQR.hpp: No such file or directory
44 | #include "SuiteSparseQR.hpp"
CMakeLists.txt:
find_package(SuiteSparse)
**
2、单独编译ceres-sover包就不会出现这个问题。。。崩溃
**
仔细看了ceres-sover的CMakeLists.txt,发现它里面也有类似命令find_package(SuiteSparse),但是它找不到不会报错能够继续,不过它里面有个cmake文件夹,下面有FindSuiteSparse.cmake文件,推测它是通过cmake去找的这个文件。
解决方法:
既然找到了问题的原因,那就让编译时系统也去调用这个FindSuiteSparse.cmake文件,修改CMakeLists.txt
include(/home/yjh/tem/bak/ceres-solver/cmake/FindSuiteSparse.cmake)
find_package(SuiteSparse)
然后编译
同样会打印
has asked CMake to find a package configuration file provided by
“SuiteSparse”, but CMake did not find one.
Could not find a package configuration file provided by “SuiteSparse” with
any of the following names:
SuiteSparseConfig.cmake
suitesparse-config.cmake
不过系统好像可以正常编译了