gpt4 book ai didi

cmake - 安静或不那么冗长的 CMake 构建工具模式

转载 作者:行者123 更新时间:2023-12-03 22:22:40 31 4
gpt4 key购买 nike

我正在使用 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>

有没有办法告诉 CMake 抑制这些信息,只打印 foo 的输出?

最佳答案

原来输出不是 CMake 的输出,而是底层原生构建工具的输出。命令行选项可以在 -- 之后传递给它像这样:

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

如果您的构建工具没有 --quiet 模式,您可以使用 tail作为跳过前 n 行的解决方法:
$ cmake --build . --target check | tail -n +90

关于cmake - 安静或不那么冗长的 CMake 构建工具模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45575227/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com