[cmake-developers] Timestamp of VS-generator rule files

Mike.Pagel at bmw.de Mike.Pagel at bmw.de
Thu Sep 17 05:03:55 EDT 2015


Hi,

we are running into problems when using add_custom_command() without inputs. The semantics of this is documented as "If DEPENDS is not specified the command will run whenever the OUTPUT is missing", which is exactly what we need. This is working everywhere, but not (cleanly) with VisualStudio generators, which introduce the rule file.

The documented behavior is violated if the custom command's output existed before the CMake generator runs. VisualStudio will then always trigger the command, as its input (the rule file) is newer than the outputs. Unfortunately, some of our generators notice that the output does not change and does not touch the output timestamp. This prevents dependent targets from rebuilding, but the generators will be triggered, which is time-consuming.

We can think of a number of workarounds for this, but I wanted to see whether there is general agreement that the behavior between non-VS and the VS generators should be identical and according to documentation. A fix in the CMake code could force "old" rule files, which then would never trigger the command on their own.

Please let me know, what you think,
Mike



More information about the cmake-developers mailing list