CMake-Eigen3_DIR-NOTFOUND

问题描述 投票:0回答:1

[我正在尝试在Windows 10上使用CMake构建项目。但是我一直在数小时内收到此错误:

错误:

  CMake Error at of_dis/CMakeLists.txt:8 (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.

我下载了Eigen,然后解压缩,并添加了一个名为EIGEN3_INCLUDE_DIR的新环境变量,其值为C:\eigen-3.3.7\cmake。还向项目的CMake文件添加了一行,现在看起来像这样:

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

project(IMOT_OpticalFlow_Edges)

find_package(OpenCV REQUIRED)

add_subdirectory(of_dis)

include_directories(./of_dis ${OpenCV_INCLUDE_DIRS})
INCLUDE_DIRECTORIES ( "$ENV{EIGEN3_INCLUDE_DIR}" )

set(CMAKE_CXX_STANDARD 11)

#set(OpenCV_DIR "C:/opencv/opencv3.4.1/opencv-3.4.1/build/install")
set(OpenCV_DIR "C:/opencv/opencv3.4.1/opencv-3.4.1/build/install/x64/vc14/lib")

set(SOURCE_FILES src/main.cpp src/support/Place.cpp src/support/Line.cpp src/support/Argument.cpp
    src/support/FileOperations.cpp src/frame_processing/FrameProcessor.cpp src/flow_processing/FlowProcessor.cpp
    src/edge_processing/EdgeProcessor.cpp src/detection/Detector.cpp)

add_executable(IMOT_OpticalFlow_Edges ${SOURCE_FILES})

target_link_libraries(IMOT_OpticalFlow_Edges ${OpenCV_LIBS})

CMake GUI:

enter image description here

我还在当前项目中复制了FindEigen3.cmake文件。但是我仍然一遍又一遍地遇到同样的错误。有没有办法解决这个问题?

cmake eigen3
1个回答
0
投票

总结评论以确保完整性:

CMake的find_package()命令具有两种操作模式:ModuleConfig模式。此错误实质上表示Module模式失败,然后Config模式无法找到Eigen3程序包:

find_package()

[通常,安装软件包XXX(例如Eigen3)时,该软件包应配置 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. 文件。这样,外部项目可以通过在Config模式下调用XXXConfig.cmake来查找和使用软件包XXX。

因为您的Eigen3软件包是未安装,所以未配置find_package()文件。因此,Module模式搜索应该适合您,因为Eigen3目录中仅存在Eigen3Config.cmake文件。对于Module模式,必须将FindEigen3.cmake文件的路径添加到FindEigen3.cmake,如错误所示。在CMAKE_MODULE_PATH调用之前添加此行可使CMake进入Module模式成功:

CMAKE_MODULE_PATH
© www.soinside.com 2019 - 2024. All rights reserved.