About compile_commands.json(CLion 24.3.4)

Answered

I'm using Xmake to build my embedded project(because it's easier to write config file than cmake), and i use it to generate a compile_commands.json in order to manage my project src files. But i have a question ,i don't have a CmakeList.txt in peoject ,when i open the compile_command.json as a project ,Clion always tell me that i don't have a cmakelist.txt. what i want to know is that it's possible to use  compile_command.json to activate clangd's syntax checking and highlighting without making a cmakelist.txt? And i found that the Compile DB in my Setting show that “No Compile DB Found”,but i true have a compile_commands.json in my project root.

here's my compile_commands.json and my Settings show:

2
2 comments

Hello!

Based on the provided screenshots, it looks like the project is, for some reason, opened as a CMake project in CLion. Please do the following:

  1. Close the project in CLion (File | Close Project);
  2. Remove the .idea and cmake-build-debug-armclang subdirectories from the project;
  3. Click Open on the “Welcome to CLion” screen;
  4. Locate the compile_commands.json file and then click Open;
  5.  Click Open as Project.

After that, the project will be opened as a compilation database project in CLion.

1

Out of the box, CLion supports GCC-based compilers, Clang, Clang-cl, Visual Studio C++ compiler, and IAR compiler. If the compiler is not recognized by CLion, you can use the custom compiler option - https://www.jetbrains.com/help/clion/custom-compilers.html.

0

Please sign in to leave a comment.