Command line equivalent of cmake's find_package?

我的未来我决定 提交于 2020-08-21 01:59:42

问题


I'm debugging a cmake file which fails to find certain packages (using find_package()). What does find_package() actually do when it searches for packages, and can I simulate it with a command line call (without invoking cmake)?


回答1:


1. What find_package does:

From the documentation of find_package():

CMake searches for a file called Find.cmake in the CMAKE_MODULE_PATH followed by the CMake installation. If the file is found, it is read and processed by CMake.

On Linux, the default scripts usually are located here:

ls /usr/share/cmake*/Modules/Find*.cmake

2. How to use find_package on the command-line:

# 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


来源:https://stackoverflow.com/questions/28863366/command-line-equivalent-of-cmakes-find-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!