> On 18. Oct 2024, at 11:14, Christian Kandeler via Qt-creator > <qt-creator@qt-project.org> wrote: > > On 10/17/24 1:27 PM, Hugo Melder via Qt-creator wrote: >> 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?
> We generate our own compilation database file with the necessary tweaks for > clang. Can you point me to the source where you are processing the compiler flags? We have the problem that QTC does not pick up various Objective-C Runtime Flags which are set in CMake. I’ll provide a demo shortly. > If you want to trick clangd in using a different one, you are on your own. We would like to avoid hacking around QTC, and we are not altering the way clangd gets the compilation database in QTC. However running clangd with compile commands generated by CMake works perfectly on VSCode, so something is broken either on our side or In QTC. ~ Hugo -- Qt-creator mailing list Qt-creator@qt-project.org https://lists.qt-project.org/listinfo/qt-creator