Hello all - If a build directory is generated with -DCMAKE_EXPORT_COMPILE_COMMANDS=1, and then the CMake command is run again identically but with a (different) value for --DCMAKE_CXX_COMPILER or -DCMAKE_C_COMPILER, the compiler_commands.json file, if generated, is not regenerated. Naively, I would expect that this file, since it depends on the modified variables, to be regenerated.
Is my expectation correct? I.e., is this a bug? Thank you!
You can’t normally change the compiler/toolchain for an existing build directory. I’m surprised CMake isn’t issuing a warning of some kind if you try to do that. If you want to change the value of CMAKE_CXX_COMPILER or CMAKE_C_COMPILER, you should add the --fresh option when running cmake. That will force CMake to discard its cached toolchain details and recompute them from scratch. I’d expect you would see any relevant changes in compiler_commands.json after that too.