在Cmake中如何在不清除目标文件的情况下使用新的源文件更新makefile [英] In Cmake how to update the makefiles with new source files without cleaning the object files

查看:72
本文介绍了在Cmake中如何在不清除目标文件的情况下使用新的源文件更新makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cmake,我刚刚添加了新的源文件,我想将该新的源文件包括在cmake生成的makefile中,以包括在建筑物中.我尝试了rebuild_cache,但没有任何反应.

I'm using cmake, and I just added new source files and I want to include that new source files in the cmake generated makefiles to include in the building. I tried rebuild_cache but nothing happens.

谢谢!

推荐答案

这取决于您的cmake文件的构建方式.如果使用GLOB,则无论何时添加或删除源文件,都必须手动运行cmake.如果您明确列出了源文件,只需再次运行make.CMake将检测到更改后的CMakeLists.text.

It depends how your cmake file was built. If you use GLOB, you must run cmake manually any time you add or remove a source file. If you explicitly list your source files, just run make again. CMake will detect the changed CMakeLists.text.

CMake为此建议使用后者:

CMake suggests the latter for this reason:

我们不建议使用GLOB从源代码树中收集源文件列表.如果在添加或删除源时没有CMakeLists.txt文件更改,则生成的生成系统将不知道何时要求CMake重新生成.

We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.

CMake文档

这篇关于在Cmake中如何在不清除目标文件的情况下使用新的源文件更新makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆