Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
命令行等效于cmake';我们找到你的包裹了吗?_Cmake - Fatal编程技术网

命令行等效于cmake';我们找到你的包裹了吗?

命令行等效于cmake';我们找到你的包裹了吗?,cmake,Cmake,我正在调试一个cmake文件,该文件找不到某些包(使用find\u package())。find_package()在搜索包时实际做了什么,我可以用命令行调用(不调用cmake)来模拟它吗?1。find_软件包的作用: # cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=EXIST Boost found # cmake --find-package -DNAME=Boost -DCOMPILER

我正在调试一个cmake文件,该文件找不到某些包(使用
find\u package()
)。
find_package()
在搜索包时实际做了什么,我可以用命令行调用(不调用cmake)来模拟它吗?

1。find_软件包的作用:

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=EXIST
Boost found

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE
-I/usr/include

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK
   -rdynamic
从:

CMake在CMake_模块_路径中搜索名为Find.CMake的文件,然后是CMake安装。如果找到该文件,CMake将读取并处理该文件

在Linux上,默认脚本通常位于以下位置:

ls /usr/share/cmake*/Modules/Find*.cmake
2。如何在命令行上使用find_包:

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=EXIST
Boost found

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE
-I/usr/include

# cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK
   -rdynamic

根据man cmake的说法,这“不应用于新项目”。但是您可以使用类似于
pkg-config-aruco--modversion