With ExternalProject_Add
/add_custom_command
/etc, what’s the best way to pass verbosity through as extra arguments?
Ideally increasing build-time verbosity via make VERBOSE=1
or similar can also call some command --verbose do
(while regular make
calls some command do
)… but $<VERBOSE>
isn’t a valid generator expression.
Simplistically, a one-liner like:
ExternalProject_Add(foo
...
BUILD_COMMAND some command $<$<BOOL:VERBOSE>:--verbose> do
...
)
$<$<BOOL:${VERBOSE}>:--verbose>
works (configure-time), except that when it’s not set you end up with ""
as an argument, which causes argument-parsing issues for the inner command.
How are others solving this cleanly? I know I can append to an arglist but it quickly gets unwieldy with many commands:
set(myBuildCommand some command)
if(VERBOSE)
list(APPEND myBuildCommand --verbose)
endif()
list(APPEND myBuildCommand do)
ExternalProject_Add(foo
...
BUILD_COMMAND ${myBuildCommand}
...
)