且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CMake找不到Eigen3

更新时间:2022-01-10 06:43:20

对我来说,当我安装eigen3包(例如使用-DCMAKE_INSTALL_PREFIX = / home / doriad / install),并且还将使用eigen3的cmake包的CMAKE_INSTALL_PREFIX变量设置为同一目录。

It worked for me, when I installed the eigen3 package (e.g. using -DCMAKE_INSTALL_PREFIX=/home/doriad/install), and also set the CMAKE_INSTALL_PREFIX variable of the cmake package that is using eigen3 to the same directory.

由于findscripts的问题,我实际上开始使用 pkg -config 。为此,您需要在eigen3 cmake中启用pkg-config支持,并在您自己的cmake脚本中使用pkg-config宏。优点是您不再需要设置任何环境变量了。

Because of the problems with findscripts, I've actually started using pkg-config instead. For that you need to enable pkg-config support in the eigen3 cmake, and use the pkg-config macro in your own cmake script. Advantage is that you don't need to set any environment variables anymore.

find_package( PkgConfig )
pkg_check_modules( EIGEN3 REQUIRED eigen3 )
include_directories( ${EIGEN3_INCLUDE_DIRS} )