简体   繁体   English

在Windows中配置cmake项目时找不到Eigen3_DIR

[英]Not found Eigen3_DIR when configuring a cmake project in Windows

I want to compile an open project , it needs Eigen3, I followed its guideline but stuck in this step: 我想编译一个打开的项目 ,它需要Eigen3,我遵循了它的指导方针,但仍停留在此步骤中:

"Set environment variable Eigen3_DIR to {YOUR_EIGEN3_DIRECTORY}/eigen3/cmake." “将环境变量Eigen3_DIR设置为{YOUR_EIGEN3_DIRECTORY} / eigen3 / cmake。”

I have installed CMake gui and it printed following errors after configuration 我已经安装了CMake gui并在配置后打印了以下错误

Make Error at src/CMakeLists.txt:15 (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" 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.

But I have downloaded Eigen3 from here , and set the Eigen3_DIR as follows 但是我已经从这里下载了Eigen3,并设置了Eigen3_DIR如下 在此处输入图片说明 So what should I do to fix it? 那我该怎么办呢? I am just a beginner in cmake. 我只是cmake的初学者。

I am assuming you are using Windows. 我假设您正在使用Windows。 You will need Visual Studio installed. 您将需要安装Visual Studio。 You can use the community version. 您可以使用社区版本。 You will need to do the following: 您将需要执行以下操作:

  1. Create a directory called "build" within your Eigen directory. 在您的Eigen目录中创建一个名为“ build”的目录。
  2. Go to the build directory and do "cmake ..". 转到构建目录并执行“ cmake ..”。 This will create Visual Studio projects. 这将创建Visual Studio项目。
  3. Load the .sln using Visual Studio. 使用Visual Studio加载.sln。
  4. Build the solution. 构建解决方案。
  5. Ensure that the project called INSTALL was built also. 确保还建立了名为INSTALL的项目。

This will create the Eigen3Config.cmake file in your install directory. 这将在安装目录中创建Eigen3Config.cmake文件。 In my case the install directory was "C:\\Program Files(X86)\\Eigen3. Use this to as the value for Eigen3_DIR variable. By default Eigen does not come with the Eigen3Config.cmake file. You will see Eigen3Config.cmake.in file. This is used to build the Eigen3Config.cmake file. 在我的情况下,安装目录为“ C:\\ Program Files(X86)\\ Eigen3。使用它作为Eigen3_DIR变量的值。默认情况下,Eigen并不随Eigen3Config.cmake文件一起提供。您将看到Eigen3Config.cmake.in文件,用于构建Eigen3Config.cmake文件。

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM