当前位置:网站首页>[cmake命令笔记]find_path
[cmake命令笔记]find_path
2022-06-22 09:17:00 【蓝域小兵】
在编译basalt时,cmake提示需要3.4.0版本的Eigen,而且在find_package中添加了exact参数,所以还不能改。
然而我系统中使用apt安装的eigen是3.3.7版本的。因此下载安装了3.4.0版本的Eigen,但是cmake还是找不到这个版本的Eigen。
查看basalt的编译文件发现他是使用FindEigen3.cmake文件查找Eigen库的,即在CMakelists.txt中用find_package()找到库,然后findpackage使用module模式进行查找,见CMake搜索方式
因此只需要修改FindEigen3.cmake文件就可以进行查找,在FindEigen3.cmake文件中就有使用find_path。
这里将find_path命令的官方文档翻译如下
原文链接—CMake3.23.1—find_path
find_path
精简的命令签名为:
find_path (<VAR> name1 [path1 path2 ...])
一般化的命令签名为
find_path (
<VAR>
name | NAMES name1 [name2 ...]
[HINTS [path | ENV var]... ]
[PATHS [path | ENV var]... ]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
[DOC "cache documentation string"]
[NO_CACHE]
[REQUIRED]
[NO_DEFAULT_PATH]
[NO_PACKAGE_ROOT_PATH]
[NO_CMAKE_PATH]
[NO_CMAKE_ENVIRONMENT_PATH]
[NO_SYSTEM_ENVIRONMENT_PATH]
[NO_CMAKE_SYSTEM_PATH]
[CMAKE_FIND_ROOT_PATH_BOTH |
ONLY_CMAKE_FIND_ROOT_PATH |
NO_CMAKE_FIND_ROOT_PATH]
)
首先需要知道命令行语法参数<>, [], | 分别表示什么意思
这个命令用于找到一个目录,这个目录包含the named file(应该就是命令参数中的name、NAMES这些参数指定的文件),如果选择了NO_CACHE参数,那么<VAR>指定的变量就会被创建以保存命令的查找结果。查找成功,那么查找结果会被保存到<VAR>中,如果没有找到,那么结果会被被保存为<VAR>-NOTFOUND。
可选项包括
NAMES
这里是要么直接写name,要么写NAMES name1 [name2 …]的意思。就是需要查找的文件项。
HINTS, PATHS
除默认位置外,其他指定需要搜索的目录。ENV var子可选项从系统环境变量中读取路径。
PATH_SUFFIXS
指定额外需要检查的子目录以在每个目录下方进行检查。(otherwise considered不知道啥意思)
NO_DEFAULT_PATH
不查找默认路径
知道上面几个参数已经差不多了
以下面的命令为例,这是为了查找EIGEN3这个库所在位置,signature_of_eigen3_matrix_library是eigen3这个库中的一个文件,这个文件所在的目录就是库所在的目录,因此使用find_path查找这个文件并将结果保存到EIGEN3_INCLUDE_DIR_NAMES。
HINTS 提供了一个搜索的路径,是变量EIGEN_INCLUDE_DIR_HINTS提供的。
NO_DEFAULT_PATH表示不查找默认路径,比如/usr/local/include、/usr/include等等路径。
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
HINTS ${EIGEN_INCLUDE_DIR_HINTS}
NO_DEFAULT_PATH
)
边栏推荐
- Comparison of interface abstract classes
- Typical cases of final
- rewrite? Reload? Are you dizzy?
- 锁-ReentrantLock
- 機器學習|nltk_Data下載錯誤|nltk的stopwords語料下載錯誤解决方法
- list_head
- Originality: dozens of lines of pure PHP code decrypt goto encrypted PHP single file [for learning only]
- Project optimization + online (Master?)
- cocoscreator编译报错记录 Could not write cache value 。。。.gradle\daemon\4.10.3\regi
- 通过docker安装mysql(5.7+8.0)并配置主从复制(GTID+增强半同步)
猜你喜欢

架设多个web站点

Feedforward and backpropagation

Hoo Research Institute of Hufu: how does cosmos connect the chain with the "port" of the chain?

逻辑回归和线性回归

It is hoped that more and more women will engage in scientific and technological work

Logistic regression and linear regression

Kali Trojan invades win7 system

Opencv daily function histogram correlation (3)

Audio and video 2022 beauty function introduction teach you to play video beauty

DOM programming
随机推荐
Summary and future prospect of transfer learning | community essay solicitation
C语言刷题 | 判断某年是否只闰年(15)
VMware installation Kali
[node] theory + practice enables you to win sessions and cookies
模糊查询和聚合函数
IS_ERR()
Share 830 spider IP segments (by analyzing 1g logs)
Servlet的生命周期
一文走近ZMQ
性能优化专题
PHP online common color comparison table
进程状态汇总
一个老开源人的自述-如何干好开源这件事
函数总结(1)
Have you ever paid attention to those classes in the collection that are thread safe?
[network security officer] an attack technology that needs to be understood - high hidden and high persistent threats
Stream stream creation_ Operation_ Collection_ case
DOM编程
Win+sublime Text3 + go 1.9.2 environment setup diagram
支付-订单案例构建