Add option to enable CMAKE_EXPORT_COMPILE_COMMANDS by default
There was some discussion on adding an option to enable
CMAKE_EXPORT_COMPILE_COMMANDS by default in #18386 (closed) but I don't think it was ever added.
Pretty much every CMake project I configure these days I add
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON to make clangd work. It would be great to have an environment variable such as CMAKE_GENERATOR that I can set once to have compile_commands.json generated for every project I configure with CMake without having to specify
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON on the command line each time. A config option somewhere would also work but environment variables keeps stuff in once place as they're used to configure other stuff as well. An alias for the cmake command doesn't really work as it breaks when using
cmake --build or