如何在 Windows 上的 eigen3 中启用 pkg-config 支持?
How to enable pkg-config support in eigen3 on Windows?
我正在编译第 3 方库,它使用以下命令查找 Eigen3:
find_package( PkgConfig )
pkg_check_modules( EIGEN3 REQUIRED eigen3 )
include_directories(${EIGEN3_INCLUDE_DIRS})
find_package( PkgConfig )
命令 运行 正确,因为我指定了 PKG_CONFIG_EXECUTABLE
变量。但是pkg_check_modules( EIGEN3 REQUIRED eigen3 )
returns报错:
-- Checking for module 'eigen3'
-- No package 'eigen3' found
Eigen3 的 official webpage 说“没有必要使用 CMake 或安装任何东西。”我花了很长时间才意识到这个说法是错误的。所以我运行下面编译安装Eigen3(版本3.3.5):
cmake -DCMAKE_CONFIGURATION_TYPES=Release -DCMAKE_INSTALL_PREFIX=E:rd-parties\eigen-3.3.5\install_ -G"Visual Studio 14 2015 Win64" ..
编译和安装过程都成功了,因为我在VS2015中没有看到任何失败。但是,当我回到第 3 方库的构建文件夹并再次 运行 cmake 时,我得到了完全相同的错误。 Eigen3 official website only provides an instruction using find_package
, but not pkg-config.exe, so I next searched Google and find this thread. The answer says we need to "enable pkg-config support in the eigen3 cmake". I don't know how to enable it. Is there any specific CMake variable for this purpose? Since it is a new problem, and Eigen's main page 说“要获得帮助,Whosebug 是您最好的资源。”所以我来这里寻求帮助。我的问题是:如何在 eigen3 中启用 pkg-config 支持?或者换句话说:如何传递 pkg_check_modules( EIGEN3 REQUIRED eigen3 )
cmake 命令?非常感谢。
PS:我正在研究 Windows 10.
根据 Eigen3 sources,选项 EIGEN_BUILD_PKGCONFIG
负责 pkg-config
支持。
在 Windows 上,整个选项被禁用,但您可以尝试设置它:
cmake -DEIGEN_BUILD_PKGCONFIG=ON <... other arguments>
在CMake脚本中使用pkg-config
查找Eigen3时,确保Eigen3的安装目录在CMAKE_PREFIX_PATH
变量中列出。 (如果项目使用的CMake版本低于3.1,那么你需要额外设置PKG_CONFIG_USE_CMAKE_PREFIX_PATH
到ON
来告诉pkgconfig
模块使用变量CMAKE_PREFIX_PATH
。更多见pkgconfig
模块的 documentation。)
我正在编译第 3 方库,它使用以下命令查找 Eigen3:
find_package( PkgConfig )
pkg_check_modules( EIGEN3 REQUIRED eigen3 )
include_directories(${EIGEN3_INCLUDE_DIRS})
find_package( PkgConfig )
命令 运行 正确,因为我指定了 PKG_CONFIG_EXECUTABLE
变量。但是pkg_check_modules( EIGEN3 REQUIRED eigen3 )
returns报错:
-- Checking for module 'eigen3'
-- No package 'eigen3' found
Eigen3 的 official webpage 说“没有必要使用 CMake 或安装任何东西。”我花了很长时间才意识到这个说法是错误的。所以我运行下面编译安装Eigen3(版本3.3.5):
cmake -DCMAKE_CONFIGURATION_TYPES=Release -DCMAKE_INSTALL_PREFIX=E:rd-parties\eigen-3.3.5\install_ -G"Visual Studio 14 2015 Win64" ..
编译和安装过程都成功了,因为我在VS2015中没有看到任何失败。但是,当我回到第 3 方库的构建文件夹并再次 运行 cmake 时,我得到了完全相同的错误。 Eigen3 official website only provides an instruction using find_package
, but not pkg-config.exe, so I next searched Google and find this thread. The answer says we need to "enable pkg-config support in the eigen3 cmake". I don't know how to enable it. Is there any specific CMake variable for this purpose? Since it is a new problem, and Eigen's main page 说“要获得帮助,Whosebug 是您最好的资源。”所以我来这里寻求帮助。我的问题是:如何在 eigen3 中启用 pkg-config 支持?或者换句话说:如何传递 pkg_check_modules( EIGEN3 REQUIRED eigen3 )
cmake 命令?非常感谢。
PS:我正在研究 Windows 10.
根据 Eigen3 sources,选项 EIGEN_BUILD_PKGCONFIG
负责 pkg-config
支持。
在 Windows 上,整个选项被禁用,但您可以尝试设置它:
cmake -DEIGEN_BUILD_PKGCONFIG=ON <... other arguments>
在CMake脚本中使用pkg-config
查找Eigen3时,确保Eigen3的安装目录在CMAKE_PREFIX_PATH
变量中列出。 (如果项目使用的CMake版本低于3.1,那么你需要额外设置PKG_CONFIG_USE_CMAKE_PREFIX_PATH
到ON
来告诉pkgconfig
模块使用变量CMAKE_PREFIX_PATH
。更多见pkgconfig
模块的 documentation。)