There are multiple ways to specify the compiler to use, such as:
- Using the --cc command line option.
- Using the --cmake-cache command line option.
- Using a --cmake-define=CMAKE_C_COMPILER=xxx command line option.
- ...
Nonetheless, in the report.json file, the compiler pointed to by the
--cc command line option is reported, irrespective of the compiler
actually used by cmake during compilation.
This patch fixes that by getting the compiler used from the
CMakeCache.txt file rather than from the --cc command line option.
I am not a big fan of using check_output for anything but the simplest uses. In this case we can't do anything with the output until the command finishes running, and the stderr is not interleaved with the output. And when it fails we give the user a nice exception as an error message.
Our ci scripts in zorg have a much nicer implementation, they print a shell like version of the command that you can paste in your own terminal, stream all the outputs and give real error messages. I will probably try and put them in here some day. Until then, you have not made this worse :)