CMP0175: The USES_TERMINAL keyword is valid for add_custom_command(TARGET)
Originally reported in the forums here: https://discourse.cmake.org/t/cmake-3-31-replacement-for-add-custom-command-target-uses-terminal
When CMP0175 was added in !9785 (merged), it erroneously left out USES_TERMINAL
as a valid keyword of the TARGET
form of add_custom_command()
. For at least Ninja, this keyword is supported, although its behavior isn't necessarily what may be expected. Looking at the implementation, it appears that if multiple add_custom_command(TARGET)
calls are made for a given target and that target is a utility target (I'm still working out what that means), then if any of those calls set USES_TERMINAL
to true, it will apply to all of them. This behavior is in cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements()
. For regular targets, I think this doesn't occur and USES_TERMINAL
only applies to the add_custom_command(TARGET)
call that it is set for. These subtleties might be considered internal implementation details and not something the documentation should mention, but noting it here in case there's a different view.