我正在使用 CMake 构建工具模式来构建自定义目标。自定义目标调用一个命令(比如,foo),我对它的输出感兴趣。
但是在打印foo输出之前,CMake 还会打印几行我不感兴趣的输出:
$ 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>
Run Code Online (Sandbox Code Playgroud)
有没有办法告诉 CMake 抑制这些信息,只打印foo?
原来输出不是 CMake 的输出,而是底层原生构建工具的输出。命令行选项可以--像这样传递给它:
$ cmake --build . --target check -- -quiet
Run Code Online (Sandbox Code Playgroud)
如果您的构建工具没有 --quiet 模式,您可以将其tail用作跳过前 n 行的解决方法:
$ cmake --build . --target check | tail -n +90
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3822 次 |
| 最近记录: |