Configure a CLion project
Configure a project in the CLion C/C++ IDE.
Configure a CLion compilation database project
For best performance, configure the project as a compilation database project:
-
Run
./yb_build.sh compilecmds
to generate thecompile_commands.json
file in theyugabyte-db
directory. -
Verify that
compile_commands.json
is present in theyugabyte-db
folder. From theyugabyte-db
folder, run the following command:$ find . -name "compile_commands.json"
You should see output similar to the following:
./compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/combined_raw/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/yb_postprocessed/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/yb_raw/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/combined_postprocessed/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/pg_raw/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/pg_postprocessed/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/postgres_build/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/postgres_build/contrib/compile_commands.json ./build/compilecmds-clang-dynamic-arm64-ninja/postgres_build/third-party-extensions/compile_commands.json
-
If
./compile_commands.json
is not there, then make a symlink to the one in the build folder as follows:ln -s build/compilecmds-clang-dynamic-arm64-ninja/compile_commands/combined_postprocessed/compile_commands.json compile_commands.json
Replace
compilecmds-clang-dynamic-arm64-ninja
as appropriate. -
Close the CLion project.
-
If you previously opened the folder in CLion, delete the
.idea
folder in theyugabyte-db
folder:rm -r .idea
-
Re-open the
yugabyte-db
folder in CLion. -
When prompted to open the folder as a CMake project or as a Compilation Database project, choose Compilation Database project.