• <bdo id='xjcwU'></bdo><ul id='xjcwU'></ul>

      <small id='xjcwU'></small><noframes id='xjcwU'>

      <i id='xjcwU'><tr id='xjcwU'><dt id='xjcwU'><q id='xjcwU'><span id='xjcwU'><b id='xjcwU'><form id='xjcwU'><ins id='xjcwU'></ins><ul id='xjcwU'></ul><sub id='xjcwU'></sub></form><legend id='xjcwU'></legend><bdo id='xjcwU'><pre id='xjcwU'><center id='xjcwU'></center></pre></bdo></b><th id='xjcwU'></th></span></q></dt></tr></i><div id='xjcwU'><tfoot id='xjcwU'></tfoot><dl id='xjcwU'><fieldset id='xjcwU'></fieldset></dl></div>

    1. <tfoot id='xjcwU'></tfoot><legend id='xjcwU'><style id='xjcwU'><dir id='xjcwU'><q id='xjcwU'></q></dir></style></legend>

      1. 无法使用 CMake 找到 Eigen3

        时间:2023-08-26

      2. <small id='aFhET'></small><noframes id='aFhET'>

          <i id='aFhET'><tr id='aFhET'><dt id='aFhET'><q id='aFhET'><span id='aFhET'><b id='aFhET'><form id='aFhET'><ins id='aFhET'></ins><ul id='aFhET'></ul><sub id='aFhET'></sub></form><legend id='aFhET'></legend><bdo id='aFhET'><pre id='aFhET'><center id='aFhET'></center></pre></bdo></b><th id='aFhET'></th></span></q></dt></tr></i><div id='aFhET'><tfoot id='aFhET'></tfoot><dl id='aFhET'><fieldset id='aFhET'></fieldset></dl></div>
          • <legend id='aFhET'><style id='aFhET'><dir id='aFhET'><q id='aFhET'></q></dir></style></legend>

                <bdo id='aFhET'></bdo><ul id='aFhET'></ul>
                  <tbody id='aFhET'></tbody>

                  <tfoot id='aFhET'></tfoot>
                • 本文介绍了无法使用 CMake 找到 Eigen3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有点绝望:对于我的学习,我需要使用 Eigen 和 CMake.如果我将整个库复制到编译器默认查找的目录中,但一旦我尝试通过
                  找到它,我就可以使用 Eigenfind_package(Eigen3 REQUIRED)
                  我收到以下错误:

                  <代码>/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake 处的 CMake 错误:148(消息):找不到 Eigen3(缺少:EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)(至少需要版本2.91.0")调用堆栈(最近调用优先):/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)FindEigen3.cmake:76 (find_package_handle_standard_args)CMakeLists.txt:8 (find_package)

                  -- 配置不完整,出现错误!


                  现在我搜索了解决方案,但都是我尝试过的(还有那些在stackoverflow上可用的:
                  查找 CMake 的 Eigen3 包或者CMake 找不到 Eigen3 )不工作.我的特征版本(根据 Core/util/Macros.h 中的宏)是 3.2.5.我将 Eigen 目录保存在 /usr/local/include 中,我使用了 Eigen 库附带的 FindEigen3.cmake 和我的 CMakeLists.txt> 看起来如下:

                  <代码>cmake_minimum_required(版本 2.8)项目(测试)设置(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})find_package(需要Eigen3)包含目录(${EIGEN3_INCLUDE_DIR})message("在:${EIGEN3_INCLUDE_DIR} 中找到 Eigen3")add_executable(主测试.cpp)

                  有人知道出了什么问题吗?

                  亲切的问候,朱利安

                  解决方案

                  将我的评论转化为答案

                  查找包脚本 - 如 FindEigen3.cmake - 通常使用 find_path() 命令来检测包的包含目录(请参阅 它的文档 了解完整细节).

                  FindEigen3.cmake 使用以下代码片段:

                  <块引用>

                  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library路径${CMAKE_INSTALL_PREFIX}/包含${KDE4_INCLUDE_DIR}PATH_SUFFIXES eigen3 特征)

                  所以它看起来在 CMAKE_INSTALL_PREFIX 在 Unix/Linux 主机上默认为 /usr/local.

                  以下对我有用:

                  • 转到 Eigen 源目录并运行 CMake 和安装步骤

                    >mkdir 构建>光盘构建>cmake ..>进行安装

                  • 然后复制 - 正如你所做的 - FindEigen3.cmake 到你的项目源目录.

                  • 现在您的代码确实找到了 Eigen(只是更改为 list(APPEND ...))

                    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")find_package(需要Eigen3)

                  参考资料

                  • Eigen &CMake
                  • CMake:如果您仍然需要指定 CMAKE_MODULE_PATH,那么 find_package() 有什么用?
                  • Cmake 没有找到 Boost

                  I am kind of desperate: For my studies I need to work with Eigen and CMake. I'm able to use Eigen if I copy the whole library in the directories where my compiler looks by default but as soon as I try to find it via
                  find_package(Eigen3 REQUIRED)
                  I get the following error:

                  
                  CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
                    Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
                    (Required is at least version "2.91.0")
                  Call Stack (most recent call first):
                    /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
                    FindEigen3.cmake:76 (find_package_handle_standard_args)
                    CMakeLists.txt:8 (find_package)

                  -- Configuring incomplete, errors occurred!


                  Now I searched for solutions but all I those I tried (also those available on stackoverflow:
                  Find package Eigen3 for CMake or CMake Can't find Eigen3 ) did not work. My Eigen Version (according to the Macros in Core/util/Macros.h) is 3.2.5. I keep the Eigen directory in /usr/local/include, I use the FindEigen3.cmake which comes with the Eigen library and my CMakeLists.txt looks as follows:

                  
                  cmake_minimum_required(VERSION 2.8)
                  project(Test)
                  
                  set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
                  find_package(Eigen3 REQUIRED)
                  include_directories(${EIGEN3_INCLUDE_DIR})
                  message("Found Eigen3 in: ${EIGEN3_INCLUDE_DIR}")
                  
                  add_executable(main test.cpp)
                  

                  Has anyone an idea what's going wrong?

                  Kind regards, Julien

                  解决方案

                  Turning my comment into an answer

                  The find package scripts - like FindEigen3.cmake - normally use the find_path() command to detect the package's include directory (see it's documentation for the full details).

                  FindEigen3.cmake uses the following code snippet:

                  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
                      PATHS
                      ${CMAKE_INSTALL_PREFIX}/include
                      ${KDE4_INCLUDE_DIR}
                      PATH_SUFFIXES eigen3 eigen
                  )
                  

                  So it looks in CMAKE_INSTALL_PREFIX which on Unix/Linux hosts is /usr/local by default.

                  The following has worked for me:

                  • Go to the Eigen source directory and run the CMake and installation steps

                    > mkdir build
                    > cd build
                    > cmake ..
                    > make install
                    

                  • Then copy - as you have done - FindEigen3.cmake to your projects source directory.

                  • Now your code does find Eigen (just changed to list(APPEND ...))

                    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
                    find_package(Eigen3 REQUIRED)
                    

                  References

                  • Eigen & CMake
                  • CMake: Of what use is find_package() if you need to specify CMAKE_MODULE_PATH anyway?
                  • Cmake doesn't find Boost

                  这篇关于无法使用 CMake 找到 Eigen3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:CXX 编译器标识未知 下一篇:带有包含和源路径的 CMake - 基本设置

                  相关文章

                  <i id='RDZVK'><tr id='RDZVK'><dt id='RDZVK'><q id='RDZVK'><span id='RDZVK'><b id='RDZVK'><form id='RDZVK'><ins id='RDZVK'></ins><ul id='RDZVK'></ul><sub id='RDZVK'></sub></form><legend id='RDZVK'></legend><bdo id='RDZVK'><pre id='RDZVK'><center id='RDZVK'></center></pre></bdo></b><th id='RDZVK'></th></span></q></dt></tr></i><div id='RDZVK'><tfoot id='RDZVK'></tfoot><dl id='RDZVK'><fieldset id='RDZVK'></fieldset></dl></div>

                    <legend id='RDZVK'><style id='RDZVK'><dir id='RDZVK'><q id='RDZVK'></q></dir></style></legend>

                    • <bdo id='RDZVK'></bdo><ul id='RDZVK'></ul>

                  1. <tfoot id='RDZVK'></tfoot>

                    1. <small id='RDZVK'></small><noframes id='RDZVK'>