Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

linux - Making CMake print commands before executing

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?

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

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.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am fairly sure this will work:

make VERBOSE=1

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

set(CMAKE_VERBOSE_MAKEFILE on)

This is covered in the CMake FAQ.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...