这里的eigen是用下面安装的,
sudo apt-get install libeigen3-dev
ceres是编译后,安装到系统目录下的
sudo make install
这样cmake会自动到系统下去寻找eigen, ceres相关的cmake文件,
包含ceres和eigen引用的源文件,需要在CMakeLists.txt中这样写。
cmake_minimum_required(VERSION 3.22)project(helloworld CXX)set(CMAKE_CXX_STANDARD 20)find_package(Ceres REQUIRED)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)add_executable (helloeigen "eigen_test/helloeigen.cpp")
target_link_libraries (helloeigen Eigen3::Eigen)# helloworld
add_executable(helloceres "ceres_test/helloceres.cpp")
target_link_libraries(helloceres Ceres::ceres)