Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake: how to show the compiler's stdout

Tags:

gcc

cmake

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.

like image 495
Sogartar Avatar asked Oct 10 '12 16:10

Sogartar


People also ask

How do I print a variable value in CMake?

Run CMake and have a look at the cache with the ccmake GUI tool. Then you'll get all the variables. Or run CMake with -LH then you will get all variables printed after configuration.

How does CMake identify the compiler?

Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

How use CMake command line?

Running CMake from the command line From the command line, cmake can be run as an interactive question and answer session or as a non-interactive program. To run in interactive mode, just pass the option “-i” to cmake. This will cause cmake to ask you to enter a value for each value in the cache file for the project.


1 Answers

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.

like image 157
arrowd Avatar answered Oct 08 '22 13:10

arrowd