I have some code that is auto generated externally using another script.
Let’s say this generated in resources. In there, there is a “README.TXT” file with the generation timestamp, so the file changes every time the generation step is run.
I then have a CMake script include this auto generated code.
If there is no auto generated code yet, there is a static fallback option.
To ensure we always have the latest code, the following code has been added in the CMakeLists.txt:
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS resources/README.TXT)
If I already had auto generated code and I re-run the generation, at next build CMake reconfigures, all is well.
If I remove the generated files, CMake re-run and the fallback files are used.
However, if I have no generated files (resources and README.TXT do not exist) and I run the generation, then at next build CMake is not run.
Is that a known “limitation” of CMAKE_CONFIGURE_DEPENDS?
The documentation only talks about modification to the file, but it is not clear if creating the file is a modification.
If it is not possible using CMAKE_CONFIGURE_DEPENDS, what would be another way to do this?