Manage Included Files
An included file is not required to be listed in CMakeList.txt, compile_commands.json, or build.gradle in order to be recognized as a project file and therefore provided with code insight.
The only limitation here is for the files you include to be located under the project root (visible in the Project Tool Window).
CLion treats your included files similarly regardless of the project format (CMake, compilation database, or Gradle). See Managing included files for a CMake example, or find a compilation database example below.
Compilation database example
Suppose we have a simple compilation database project with four source files listed in compile_command.json and another source file called calendar_defs.cpp which is not.
As calendar_defs.cpp is located under the project root, we can include it from one of the sources, and CLion will treat it as a project file even without the corresponding command entry in the compilation database: