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 compilecmdsto generate thecompile_commands.jsonfile in theyugabyte-dbdirectory. -
Verify that
compile_commands.jsonis present in theyugabyte-dbfolder. From theyugabyte-dbfolder, 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.jsonis 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.jsonReplace
compilecmds-clang-dynamic-arm64-ninjaas appropriate. -
Close the CLion project.
-
If you previously opened the folder in CLion, delete the
.ideafolder in theyugabyte-dbfolder:rm -r .idea -
Re-open the
yugabyte-dbfolder in CLion. -
When prompted to open the folder as a CMake project or as a Compilation Database project, choose Compilation Database project.