My target is fixing automatically problem with “file(GLOB” what will cause linking error if new files are coming to system after Cmake is runned. Idea would be that build system rerun cmake if previous linking failed.
Perfect solution would be that I could run external command after failed build automatically.
One workaround could be that before linking build system will create file “linkingfailed.txt” and after linking file is deleted. If that file is available at next build then do GLOBing again
Build tools don’t provide such functionality generally, so CMake can’t provide any such guarantees. One could maybe hook it up with GNU make, but I don’t know if that’s possible.
The solution is to either use file(GLOB CONFIGURE_DEPENDS), but I recommend against file(GLOB) for source listing in that situation as well.
Best mitiation idea I have now is that I will add some githooks what will touch cmakefiles so that build system is regenerated always after pull, switch and checkout.
The only proplem is to run rebuild cache manually if new files comes system. Maybe I move to listing files schema after project get some maturity but now it would only cause many conflicts in merge or it cause that people stop adding files and starts writing everything to one file.