l0w-sec
l0w-sec

Reputation: 33

Automatically detect newly added source file

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?

Upvotes: 3

Views: 1904

Answers (2)

Th. Thielemann
Th. Thielemann

Reputation: 2825

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.

Upvotes: 3

usr1234567
usr1234567

Reputation: 23324

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.

Upvotes: 0

Related Questions