Automatically detect newly added source file

2020-02-15 06:31发布

My problem is that I am forced to rerun CMake each time I add a new source file, which is really annoying... Is there any way CMake could detect newly added source file automatically?

标签: cmake
2条回答
家丑人穷心不美
2楼-- · 2020-02-15 07:14

CMake does not offer such a way. How should CMake detect these new files without being called?

I am not sure whether Xcode or Visual Studio automatically re-runs CMake when new files are added.

查看更多
Lonely孤独者°
3楼-- · 2020-02-15 07:29

CMake does not have functionality to observe a folder. Some OS (e.g. MacOS X) can execute an action in case a folder was changed. Some IDEs (e.g. QtCreator V4.1 and newer) trigger an re-run of CMake in case any of the CMake files where changed.

I do not know your use case but I recommend not to use file(GLOB ...). It is better to know which files are part of your project.

查看更多
登录 后发表回答