CLion
 
Get CLion
Join the CLion 2025.1 Early Access Program and try out new features before they are released! Find out more

Compilation database

Last modified: 11 October 2024

If you are working with a project which is not based on CMake, Gradle, or Makefiles, you can still benefit from the advanced IDE features that CLion provides. One way is to import a non-CMake project and let CLion convert it into a simple CMake structure. Another option is to open a project by loading its compilation database.

A compilation database lets CLion detect project files and extract all the necessary compiler information, such as include paths and compilation flags. This approach enables you to operate in the IDE and get the full experience of its capabilities while keeping your project independent from CMake, Makefile, or Gradle.

A compilation database is a JSON-formatted file named compile_commands.json that contains structured data about every compilation unit in your project.

The following snippet shows an example of a JSON compilation database:

You can see an array of entries called command objects. Each command object represents the translation unit’s main file, the working directory, the actual compile command (or the list of arguments), and optionally the name of the output created by the compilation step. For more information about the format, refer to the official documentation.