List sources explicitly in CMakeLists.txt.

In my opinion it would be better to list the dependencies explicitly in the CMakeLists.txt rather than to construct them using glob pattern matching.

The problem with glob pattern matching is that the dependencies of a target may change without the build system noticing it. If you were to add e.g. a .c file to the source directory cmake will only notice this when it is rerun. But there is no reason for it to rerun because neither the CMakeLists.txt's nor any of the dependencies (as detected during a prior configure) have changed.

Listing the dependencies explicitly solves this problem. Whenever you add a source file you also have to add it to the CMakeLists.txt. make notices that CMakeLists.txt has changed and automatically reconfigures before doing a new build.