本文介绍了使用CMake与GNU Make:我如何看到确切的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CMake与GNU Make,并希望看到所有的命令(例如如何执行编译器,所有的标志等)。

I use CMake with GNU Make and would like to see all commands exactly (for example how the compiler is executed, all the flags etc.).

GNU make有 - debug ,但它似乎并没有帮助有任何其他选项?

GNU make has --debug, but it does not seem to be that helpful are there any other options? Does CMake provide additional flags in the generated Makefile for debugging purpose?

推荐答案

当你运行make时,添加 VERBOSE = 1 以查看完整的命令输出。例如:

When you run make, add VERBOSE=1 to see the full command output. For example:

cmake .
make VERBOSE=1

或者您可以添加 -DCMAKE_VERBOSE_MAKEFILE:

Or you can add -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON to the cmake command for permanent verbose command output from the generated Makefiles.

cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .
make

要减少一些可能不那么有趣的输出,您可能想使用以下选项。选项 CMAKE_RULE_MESSAGES = OFF 删除像 [33%] Building C object ... 这样的行,而 print-directory 告诉make不打印当前目录过滤出 make [1]:输入目录 make [1]:离开目录

To reduce some possibly less-interesting output you might like to use the following options. The option CMAKE_RULE_MESSAGES=OFF removes lines like [ 33%] Building C object..., while --no-print-directory tells make to not print out the current directory filtering out lines like make[1]: Entering directory and make[1]: Leaving directory.

cmake -DCMAKE_RULE_MESSAGES:BOOL=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .
make --no-print-directory

这篇关于使用CMake与GNU Make:我如何看到确切的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 03:48