file(GLOB|_RECURSE) add CONFIGURE_DEPENDS flag
One of the biggest drawbacks to the file(GLOB) command is that it is currently not able to check for content list changes without manually calling CMake to do a configuration run. Potential users of CMake often balk at the fact that you cannot use file(GLOB) to collect a list of source files, even though it is often argued that explicitly listing them is best practice.
This merge request addresses the issue by introducing the CONFIGURE_DEPENDS
flag for file(GLOB) and file(GLOB_RECURSE). GLOB commands marked with this flag will be treated as inputs to the configuration process, as if a user were marking a file with the CMAKE_CONFIGURE_DEPENDS property. This is achieved by caching all flagged GLOB commands to store their outputs upon initial configuration. CMake will use these lists to create a script which reevaluates the commands during the main check build system target. If the output of any of the flagged commands changes, the script will touch a stamp file to indicate this dirty status and thus trigger the normal automated CMake reconfiguration logic.
References: #11617 (closed) #11156 (closed) #9249 (closed)