In Cmake how to update the makefiles with new source files without cleaning the object files

时间秒杀一切 提交于 2021-02-05 09:01:34

问题


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.

Thanks!


回答1:


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 suggests the latter for this reason:

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 documentation



来源:https://stackoverflow.com/questions/19351489/in-cmake-how-to-update-the-makefiles-with-new-source-files-without-cleaning-the

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