问题描述
我想编译一个
那么我该怎么做才能解决它?我只是cmake的初学者。
我假设您正在使用Windows。您将需要安装Visual Studio。您可以使用社区版本。您将需要执行以下操作:
- 在Eigen目录中创建一个名为 build的目录。
- 转到构建目录并执行 cmake ..。这将创建Visual Studio项目。
- 使用Visual Studio加载.sln。
- 构建解决方案。
- 确保还建立了名为INSTALL的项目。
这将在您的安装目录中创建Eigen3Config.cmake文件。在我的情况下,安装目录为 C:\Program Files(X86)\Eigen3。使用它作为Eigen3_DIR变量的值。
默认情况下,Eigen并不随Eigen3Config.cmake文件一起提供。您将
HTH
,请参见Eigen3Config.cmake.in文件。
I want to compile an open project, it needs Eigen3, I followed its guideline but stuck in this step:
"Set environment variable Eigen3_DIR to {YOUR_EIGEN3_DIRECTORY}/eigen3/cmake."
I have installed CMake gui and it printed following errors after configuration
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 followsSo what should I do to fix it? I am just a beginner in cmake.
I am assuming you are using Windows. You will need Visual Studio installed. You can use the community version. You will need to do the following:
- Create a directory called "build" within your Eigen directory.
- Go to the build directory and do "cmake ..". This will create Visual Studio projects.
- Load the .sln using Visual Studio.
- Build the solution.
- Ensure that the project called INSTALL was built also.
This will create the Eigen3Config.cmake file in your install directory. 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.
HTH
这篇关于在Windows中配置cmake项目时找不到Eigen3_DIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!