From aa6c0f2ad11fd4909fdeef375078b8bce3dc0aad Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 27 Mar 2020 21:19:20 -0700 Subject: [PATCH] topology: cmake: silence super chatty alsatplg unless VERBOSE=1 Successfully tested with both Make and Ninja on Linux. Non-portable but approved by @jajanusz in former PR #2626 With this commit: $ make -C tools/build_tools/ | wc -l 770 $ VERBOSE=anything make -C tools/build_tools/ | wc -l 10387 Signed-off-by: Marc Herbert --- tools/topology/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/topology/CMakeLists.txt b/tools/topology/CMakeLists.txt index d47577f18..82e3715a5 100644 --- a/tools/topology/CMakeLists.txt +++ b/tools/topology/CMakeLists.txt @@ -159,11 +159,25 @@ foreach(tplg ${TPLGS}) USES_TERMINAL ) +# This use of VERBOSE relies on original CMake behavior. +# From the add_custom_command() manual: +# +# Use of VERBATIM is recommended as it enables correct behavior. +# When VERBATIM is not given the behavior is platform specific because +# there is no protection of tool-specific special characters. +# +# This is fine because: +# - We don't expect alsatplg to work on Windows any time soon. +# - CMake is too afraid to remove the original, no-VERBATIM behavior: +# https://gitlab.kitware.com/cmake/cmake/issues/18849 +# +# Also note that in alsa-utils commit v1.2.2~15-gcbabe7a3f0cc, alsatplg +# (accidentally?) started ignoring the verbosity level, now it's just +# verbose or not. add_custom_command( OUTPUT ${output}.tplg - COMMAND alsatplg -v 1 -c ${output}.conf -o ${output}.tplg + COMMAND alsatplg \$\${VERBOSE:+-v 1} -c ${output}.conf -o ${output}.tplg DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf - VERBATIM USES_TERMINAL )