Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quiet or less verbose CMake build tool mode

Tags:

cmake

I'm using the CMake build tool mode to build a custom target. The custom target invokes a command (say, foo) whose output I'm interested in.

But CMake also prints several lines of output that I'm not interested in, before printing foo's output:

$ cmake --build . --target check
=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ Rules build/delta.build/Debug/ZERO_CHECK.build/Script-6DF082DADA6745879D9E0B1F.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/delta.build/Debug/ZERO_CHECK.build/Script-6DF082DADA6745879D9E0B1F.sh
echo ""

make -f /Users/emlai/Code/delta/build/CMakeScripts/ReRunCMake.make
make[1]: `/Users/emlai/Code/delta/build/CMakeFiles/cmake.check_cache' is up to date.

=== BUILD TARGET not OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET FileCheck OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET deltaAST OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ PostBuild\ Rules build/src/ast/delta.build/Debug/deltaAST.build/Script-DFCB4F26C551468881A4AD63.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/src/ast/delta.build/Debug/deltaAST.build/Script-DFCB4F26C551468881A4AD63.sh
echo "Creating symlinks"
Creating symlinks
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_symlink_library /Users/emlai/Code/delta/build/src/ast/Debug/libdeltaAST.dylib /Users/emlai/Code/delta/build/src/ast/Debug/libdeltaAST.dylib /Users/emlai/Code/delta/build/src/ast/Debug/libdeltaAST.dylib

=== BUILD TARGET deltaSupport OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ PostBuild\ Rules build/src/support/delta.build/Debug/deltaSupport.build/Script-7CAA0CC95B4E463993DC6A8F.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/src/support/delta.build/Debug/deltaSupport.build/Script-7CAA0CC95B4E463993DC6A8F.sh
echo "Creating symlinks"
Creating symlinks
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_symlink_library /Users/emlai/Code/delta/build/src/support/Debug/libdeltaSupport.dylib /Users/emlai/Code/delta/build/src/support/Debug/libdeltaSupport.dylib /Users/emlai/Code/delta/build/src/support/Debug/libdeltaSupport.dylib

=== BUILD TARGET deltaSema OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ PostBuild\ Rules build/src/sema/delta.build/Debug/deltaSema.build/Script-73FADE92ABAA422B8804BD88.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/src/sema/delta.build/Debug/deltaSema.build/Script-73FADE92ABAA422B8804BD88.sh
echo "Creating symlinks"
Creating symlinks
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_symlink_library /Users/emlai/Code/delta/build/src/sema/Debug/libdeltaSema.dylib /Users/emlai/Code/delta/build/src/sema/Debug/libdeltaSema.dylib /Users/emlai/Code/delta/build/src/sema/Debug/libdeltaSema.dylib

=== BUILD TARGET deltaIRGen OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ PostBuild\ Rules build/src/irgen/delta.build/Debug/deltaIRGen.build/Script-228C0796627D463597C57E83.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/src/irgen/delta.build/Debug/deltaIRGen.build/Script-228C0796627D463597C57E83.sh
echo "Creating symlinks"
Creating symlinks
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_symlink_library /Users/emlai/Code/delta/build/src/irgen/Debug/libdeltaIRGen.dylib /Users/emlai/Code/delta/build/src/irgen/Debug/libdeltaIRGen.dylib /Users/emlai/Code/delta/build/src/irgen/Debug/libdeltaIRGen.dylib

=== BUILD TARGET deltaParser OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ PostBuild\ Rules build/src/parser/delta.build/Debug/deltaParser.build/Script-33329F75832D4A15AECE47BD.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/src/parser/delta.build/Debug/deltaParser.build/Script-33329F75832D4A15AECE47BD.sh
echo "Creating symlinks"
Creating symlinks
/usr/local/Cellar/cmake/3.7.2/bin/cmake -E cmake_symlink_library /Users/emlai/Code/delta/build/src/parser/Debug/libdeltaParser.dylib /Users/emlai/Code/delta/build/src/parser/Debug/libdeltaParser.dylib /Users/emlai/Code/delta/build/src/parser/Debug/libdeltaParser.dylib

=== BUILD TARGET delta OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD AGGREGATE TARGET check OF PROJECT delta WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution CMake\ Rules build/delta.build/Debug/check.build/Script-A3D22E5853C4469BA62E14D5.sh
    cd /Users/emlai/Code/delta
    /bin/sh -c /Users/emlai/Code/delta/build/delta.build/Debug/check.build/Script-A3D22E5853C4469BA62E14D5.sh
echo ""

<here's the output from foo>

Is there a way to tell CMake to suppress this information, and only print the output of foo?

like image 425
emlai Avatar asked Aug 08 '17 18:08

emlai


People also ask

What does CMake -- build build do?

CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists. txt. Users build a project by using CMake to generate a build system for a native tool on their platform.

What is build tree in CMake?

Build Tree. The top-level directory in which buildsystem files and build output artifacts (e.g. executables and libraries) are to be stored. CMake will write a CMakeCache. txt file to identify the directory as a build tree and store persistent information such as buildsystem configuration options.


1 Answers

Turns out the output wasn't CMake's output, but the underlying native build tool's. Command-line options can be passed to it after a -- like so:

$ cmake --build . --target check -- -quiet

If your build tool doesn't have a --quiet mode, you could use tail as a workaround to skip the first n lines:

$ cmake --build . --target check | tail -n +90
like image 142
emlai Avatar answered Sep 22 '22 07:09

emlai