Custom command with long list of output artifacts can generate `argument list too long` from the status messaging
I'm working with CMake project that take a large (> 100) set of input files and processes them to produce an even larger (4x the input size) set of output files. This is done with a single python script call.
In the CMake script, this is expressed as
add_custom_command(
OUTPUT ${OUTPUT_ARTIFACTS}
COMMAND ...
DEPENDS ${INPUT_ARTIFACTS}
)
It works fine on windows builds, but on Ubuntu, using makefile builds this fails because in the makefile, there's a "helpful" command in the style
@$(CMAKE_COMMAND) -E ... "Generating [SUPER LONG LIST OF OUTPUT ARTIFACTS]"
On my test system this command is almost over 197 thousand characters, so when I run make it chokes with
/bin/sh: 1: eval: /usr/bin/cmake: Argument list too long
This is super frustrating since this isn't a critical part of the build, just status messaging, which is redundant in this case since the script producing the artifacts also emits output on a per-artifact basis.
Is there a mechanism to suppress the CMake generating
message? Can CMake detect it's creating an absurdly long echo message and truncate it with ellipses? Can CMake fetch the ARG_MAX length and detect when it's going to be exceeded by a command an suppress the command?