博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cmake cannot find eigen3 in ubuntu
阅读量:4042 次
发布时间:2019-05-24

本文共 2083 字,大约阅读时间需要 6 分钟。

the reason is missing EIGEN3_INCLUDE_DIR

then we need to define it in cmakelist.txt file

add a line like this in this file:

Set(EIGEN3_INCLUDE_DIR "/usr/local/include/eigen-eigen-b30b87236a1b")

there are somthing about cmake referenced from http://stackoverflow.com/questions/12249140/find-package-eigen3-for-cmake

Since Eigen3 is completely header only, all you ever need is the path to the include directory. And this one, you are already defining manually anyway. So there is no real need for a FindEigen3.cmake or FIND_PACKAGE call.

Simply use

INCLUDE_DIRECTORIES ( "$ENV{EIGEN3_INCLUDE_DIR}" )

or

SET( EIGEN3_INCLUDE_DIR "$ENV{EIGEN3_INCLUDE_DIR}" )IF( NOT EIGEN3_INCLUDE_DIR )    MESSAGE( FATAL_ERROR "Please point the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.")ENDIF()INCLUDE_DIRECTORIES ( "${EIGEN3_INCLUDE_DIR}" )

A few notes:

  1. If you want to access the content of a CMake variable, make sure to use ${...}
  2. $ENV{....} accesses environment variables.
  3. The second example will stop with an error if the environment variable is not set (and, thus, EIGEN3_INCLUDE_DIR cmake variable is empty)
  4. Be careful to use quotation marks around (evaluated) variables if they could contain whitespace. Otherwise, CMake will interpret it as a list.
  5. If you want to use custom find modules, make sure to either place them in you CMake installation or, as @Fraser pointed out above, make sure to point CMAKE_MODULE_PATH to the directory where it is. Not sure, but it could be that CMake checks the current directory as well automatically (where your CMakeLists.txt resides. Anyhow, setting EIGEN3_INCLUDE_DIR is totally unrelated to the location of FindEigen3.cmake
  6. However, it could be that your FindEigen3 script evaluates this variable to determine the location of your Eigen3 installation.
  7. Alternatively, self-built CMake-based projects often provide a <PackageName>Config.cmake. If you point a variable called <PackageName>_DIR to the directory containing this file, you can use FIND_PACKAGE( <PackageName> ...) as normal. See for details.

你可能感兴趣的文章
Win10+VS+ESP32环境搭建
查看>>
Ubuntu+win10远程桌面
查看>>
flutter-实现圆角带边框的view(android无效)
查看>>
android 代码实现圆角
查看>>
flutter-解析json
查看>>
android中shader的使用
查看>>
java LinkedList与ArrayList迭代器遍历和for遍历对比
查看>>
drat中构造方法
查看>>
JavaScript的一些基础-数据类型
查看>>
JavaScript基础知识(2)
查看>>
转载一个webview开车指南以及实际项目中的使用
查看>>
android中对于非属性动画的整理
查看>>
一个简单的TabLayout的使用
查看>>
ReactNative使用Redux例子
查看>>
Promise的基本使用
查看>>
coursesa课程 Python 3 programming 统计文件有多少单词
查看>>
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>