在执行之前制作 CMake 打印命令 [英] Making CMake print commands before executing

查看:11
本文介绍了在执行之前制作 CMake 打印命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个在 Linux 上使用 CMake 构建的大型 C++ 项目.CMake 运行正常,在模块和应用程序树中生成了大量 Makefile.运行 GNU make 会导致链接器错误.我怎样才能让 make 在运行它们之前打印出确切的命令?

I'm working on a large C++ project built with CMake on Linux. CMake runs okay, producing a horde of Makefiles in the tree of modules and applications. Running GNU make leads to linker errors. How can I get make to print out the exact commands before running them?

-d 选项不会打印命令,但会打印大量无用的信息.

The -d option does not print the commands, but plenty of information that hasn't been helpful.

-n 选项会打印所有命令,但不会运行它们,所以我不知道问题究竟出在哪里.从 make -n 检查标准输出,我没有看到任何相关的命令.我怀疑某些命令会根据早期命令的结果而改变,而且 Makefile 的层次结构使得很难判断到底发生了什么.

The -n option prints all the commands, but does not run them, so I can't tell were exactly the trouble is. Examining the stdout from make -n, I don't see any commands that are relevant. I suspect some commands change depending on the results of earlier commands, and the hierarchy of Makefiles makes it difficult to tell what's really going on.

我在 make 的手册页面中没有看到任何其他有用的选项.

I don't see any other options in make's man page that seem helpful.

推荐答案

我很确定这会奏效:

make VERBOSE=1

您还应该能够将此添加到您的 CMakeLists.txt 以永久设置:

You should also be able to add this to your CMakeLists.txt to permanently set that:

set(CMAKE_VERBOSE_MAKEFILE on)

这在 CMake 常见问题解答中有介绍.

这篇关于在执行之前制作 CMake 打印命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆