tablegenning projects always build due to add_custom_target


The tablegenning projects of LLVM and clang always run commands since they are use add_custom_target which is ALWAYS CONSIDERED OUT OF DATE even if the commands try to create a file with the name of the target. See

This causes delay when running clang from an IDE.
41 projects run their commands without any need before clang runs.

Is there a better way to handle these targets so they will execute commands only when dependencies change, like all the other projects in LLVM?


I suppose it's possible behavior in Visual Studio (and msbuild.exe).
I don't care as far as each generating project would run but it
doesn't run any actions.

That said, patches welcome :slight_smile:

While it’s true that the project actions don’t run, when a tablegenning project runs under Visual Studio it writes a command file, updates a timestamp file, … for 41 projects this is non-neglible time.

Would it make sense to use add_custom_command instead of add_custom_target?


add_custom_command is tough. See also;

4.7 How can I add a dependency to a source file which is generated in
a subdirectory?
4.8 How can I generate a file used in more than one target in the same

It could be done to generate each clang-tblgen in each user's
directory (not clang/include). But it'd be too redundant.