When cmake runs the first time I am able to generate a file using the following:
configure_file(foo.cpp.in foo.cpp)
That works great. But if foo.cpp.in changes I would like foo.cpp to be regenerated. If I touch foo.cpp.in cmake will rerun but foo.cpp is not regenerated.
I was thinking that perhaps a custom command could be used but not sure what the command would be given I want to use configure_file.
In general to handle more advanced cases, like where file1 is read by CMake to configure_file() for file2, you can use directory property CONFIGURE_DEPENDS.