[CMake] Making cmake automatically pick up changes to directory contents.

billw at billw.mail1.co.uk billw at billw.mail1.co.uk
Mon Dec 2 12:58:10 EST 2013


I just finished converting a large project from VC project files to Cmake
generated ones and am using file GLOBing to generate the file lists for
builds. This is working fine and I don't see the benefit to explicitly
specifying every file.

I know the docs recommend not using GLOB, but the only reason given is
that cmake won't do a rebuild when new files are added. This seems like a
limitation of the build system not a good reason.

So is there any good way to cause a CMake rebuild of a project when the
contents of the directory change? I am thinking something like outputting
the directory listing to a file (i.e. dir /b/s > filelist.txt) and adding
that file as some sort of dependency to the project. But I don't know
exactly how this would be done in practice.

Any ideas or canonical methods?



More information about the CMake mailing list