1.一般安装方法
进入终端后:
git clone https://github.com/strasdat/Sophus.git
cd Sophus
mkdir build
cd build
cmake ..
make
sudo make install
2.遇到问题
当进行到cmake ..时,会显示以下问题:
CMake Error at CMakeLists.txt:42 (find_package):
By not providing "Findfmt.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "fmt", but
CMake did not find one.
Could not find a package configuration file provided by "fmt" with any of
the following names:
fmtConfig.cmake
fmt-config.cmake
Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
to a directory containing one of the above files. If "fmt" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
说的大约就是不能找到fmt这个东西。
3.解决办法
通过阅读sophus里的readme,最后有这么一句“However, it should work (with no to minor modification) on many other modern configurations as long they support c++14, CMake, Eigen 3.3.X and (optionally) fmt. The fmt dependency can be eliminated by passing "-DUSE_BASIC_LOGGING=ON" to cmake when configuring Sophus.”它说明了
安装sophus的一些依赖库,并标明fmt为可选项。
到此可以确定我的问题是缺少fmt,可以通过安装fmt来解决:
git clone https://github.com/fmtlib/fmt.git
cd fmt
mkdir build
cd build
cmake ..
make
sudo make install
安装完之后就可以顺利安装sophus了。
4.使用
需在CmakeLists中添加 target_link_libraries(fmt)
版权归原作者 Mr.棍 所有, 如有侵权,请联系我们删除。