Hi,

I cannot get QTC to pick up the compile_commands.json file generated by CMake.

Here some things I’ve tried out:
1. Create a .clangd configuration file to hard-code the compilation database 
location
2. Move compile_commands.json into the top-level of the project
3. Verify that clangd is configured with the correct workspace folder (Language 
Client Inspector)


OS Info:
WindowsBuildLabEx                                : 
22621.1.arm64fre.ni_release.220506-1250
OsName                                                  : Microsoft Windows 11 
Pro
OsVersion                                                : 10.0.22631
CsSystemType                                            : ARM64-based PC
QtCreatorVersion                                        : 14.0.1 (Enterprise)

Steps to reproduce:

1. Create a new Qt Quick Application.
2. Click on "Projects" on Sidebar
3. Add "CMAKE_EXPORT_COMPILE_COMMANDS" to initial configuration
4. Reconfigure the project

The build directory now contains a compile_commands.json file.
We can now edit compile_commands.json to test, if it is really picked up. Find 
the entry for main.cpp and add '-DFOOBAR' to the command.

QTC greys out an "#ifdef FOOBAR" block, despite FOOBAR being defined in the 
build command for main.cpp.

Does QTC support compilation databases?

~ Hugo
-- 
Qt-creator mailing list
Qt-creator@qt-project.org
https://lists.qt-project.org/listinfo/qt-creator

Reply via email to