【Cmake】.cmake 文件是什么|有什么用?

.cmake 文件谁用

.cmake 文件 是给cmake执行用的:

cmake  -P    /path/of/xxx.cmake

cmake 参数-P的解释

-P <file>
Process script mode.

Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache is not modified. If variables are defined using -D, this must be done before the -P argument.

原文链接:https://blog.csdn.net/xiaowang1379214245/article/details/78191917

 .cmake 文件的作用

就像CMakeList.txt的库一样,加载后可以在CMakeList.txt中使用它的一些函数和定义?

提供最小可用配置?

其他:

How to create a ProjectConfig.cmake file · Wiki · CMake / Community · GitLab

c++ - What is the use of .cmake files in install function of CMakeLists.txt? - Stack Overflow

Hinting Find<name>.cmake Files with a custom directory - Stack Overflow

cmake清除缓存的操作(类似 make clean)


想要通过make clean类似的操作删除CMake生成的各种文件。

发现cmake没有类似的操作,需要手动浏览目录,删除像cmake_install.cmake和CMakeCache.txt CMakeFiles文件,以及CMakeFiles文件夹。

是否有像cmake clean这样的命令来自动删除所有这些文件? 

通过查看cmake命令的help发现可以通过创建一个额外的文件夹的方式实现:

cmake -S . -B build
之后每次操作直接删除掉build文件就可以了。

原文链接:https://blog.csdn.net/daijingxin/article/details/111826612

posted on 2022-10-04 01:23  bdy  阅读(1144)  评论(0编辑  收藏  举报

导航