我正在尝试使用 Cmake_gui 和 Visual Studio 构建 ceres sovler
我将 ceres-solver 克隆到E:\Code\libs\ceres-solver 并将所需的库 Eigen3 克隆到E:\Code\libs\eigen-3.3.9
当我在 ceres-solver 上运行 cmake-gui 时,出现以下错误:
-- Detected available Ceres threading models: [CXX_THREADS, OPENMP, NO_THREADS]
-- Building with C++14
CMake Error at CMakeLists.txt:242 (find_package):
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen3" (requested
version 3.3) with any of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
我从以下位置修改了 ceres CMakeLists.txt 第 241 行:
find_package(Eigen3 3.3 REQUIRED)
至
find_package(Eigen3 3.3 REQUIRED PATH "E:/Code/libs/eigen-3.3.9")
但我仍然在上面得到这个错误
我也试过
list(APPEND CMAKE_PREFIX_PATH "E:/Code/libs/eigen-3.3.9")
set(Eigen3_DIR "E:/Code/libs/eigen-3.3.9")
我的问题是:
为 find_package 指定路径的正确方法是什么?我是否需要在 Windows 中使用路径环境变量或修改 CMakeLists.txt?
我是否在 Windows 中正确指定了此路径?我需要链接到 Eigen3 的一些内部目录吗?比如
E:\Code\libs\eigen-3.3.9\cmake
,使用正斜杠而不是反斜杠,或者使用引号作为路径?我尝试了所有这些事情都没有成功。find_package 是否递归搜索指定目录中的包?还是我需要指向确切的目录?
谢谢