This should be really simple, but I am having a hard time figuring it out. Usually, when building the project with make, only the stderr of the compiler is shown. How can I configure CMake to display the stdout of the compiler also? I am using GCC, if this should matter.
Asked
Active
Viewed 3.8k times
30
-
Not sure, but `make VERBOSE=1` and `CMAKE_VERBOSE_MAKEFILE` variable might be relevant. – arrowd Oct 10 '12 at 17:51
-
Both of these actually do the same thing and it does include the compiler's standard output to the standard output of make. The thing I wanted to do was to run only the preprocessor by giving to gcc the "-E" option. I thought wrongly that it would output the result to the standard output. It turns out it puts it in the out file. That is way I was dazzled when I did not see it. If you make an answer out of your comment I would accept it. – Sogartar Oct 11 '12 at 09:48
-
3Possible duplicate of [Using Cmake with GNU Make: How can I see the exact commands?](http://stackoverflow.com/questions/2670121/using-cmake-with-gnu-make-how-can-i-see-the-exact-commands) – Trevor Boyd Smith Oct 07 '15 at 12:27
-
If you will be doing this a lot, consider something polished and well packaged, documented, and easy to use like "Better Enums", a single-header library for doing all this and more. http://aantron.github.io/better-enums/ – Chris Uzdavinis Nov 07 '17 at 13:26
1 Answers
43
You can use make VERBOSE=1
and the CMAKE_VERBOSE_MAKEFILE
variable to show commands being run by CMake.
CMake also automatically generates preprocess targets for sources, but there is no target to preprocess every source at once. To preprocess a single file, run make source.i
, and it would appear in CMakeFiles/<targetname>.dir/source.i
. Actual paths may differ, so if it doesn't work, you can check Makefile
generated by CMake for the appropriate target.

Peter Mortensen
- 30,738
- 21
- 105
- 131

arrowd
- 33,231
- 8
- 79
- 110
-
18I agree. `set(CMAKE_VERBOSE_MAKEFILE ON)` at the top of your `CMakeLists.txt` – Offirmo Oct 11 '12 at 22:23
-
3A few examples (command lines and/or otherwise) would be in order. – Peter Mortensen Aug 31 '18 at 15:34