CMAKE_EXPORT_COMPILE_COMMANDS ignores CMAKE_C_COMPILER_LAUNCHER
Using CMAKE_EXPORT_COMPILE_COMMANDS with the following project creates an invalid compile_commands.json
file:
project(cmake_test C)
set(CMAKE_C_COMPILER_LAUNCHER mylauncher)
add_library(foo t.c)
$ export CMAKE_EXPORT_COMPILE_COMMANDS=1
$ cmake . && make VERBOSE=1
#[...]
[ 50%] Building C object CMakeFiles/foo.dir/t.c.o
mylauncher /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
#[...]
$ cat compile_commands.json
[
{
"directory": "/Users/mdiener/Work/cmake_compiler_commands",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
#[...]
Ie, the "command"
attribute is missing mylauncher
in its value, thus making it impossible to recreate the compile commands from the JSON file.