CLion 2019.2 Help

Manage Included Files

In CLion, it is unnecessary for an included file to be presented in CMakeList.txt, compile_commands.json, or build.gradle, to be recognized as a project file. This means you don't need to explicitly add such included header or source files to get the full code insight that CLion provides.

The only limitation here is for the files you include to be located under the project root (and therefore visible in the Project Tool Window).

CLion treats these included files similarly regardless of the project format (CMake, compilation database, or Gradle). See Managing CMake Project Files for a CMake example, or find a compilation database example below.

Example

  • Suppose we have a simple compilation database project with four source files presented in compile_command.json and another source file called calendar_defs.cpp that is not. This file is located under the project root, so if we include it from one of the sources, CLion will treat it as a project file (even without the corresponding command entry in the compilation database):

Last modified: 8 November 2019