Mastering CppDepend Analysis Inputs

How to analyze your C/C++ Project with CppDepend

Numerous build systems for managing C/C++ projects exist, such as Makefile, CMake, SCon, and Visual Studio. CppDepend requires comprehensive information about compilation and linking commands to conduct its analysis. CppDepend utilizes Clang for parsing source files, and it requires the following inputs for code analysis:

  • Source files.
  • Include paths.
  • Defines.
  • forced includes.

The emphasis is on creating a comprehensive compilation database, which allows for in-depth analysis of the project's structure, dependencies, and other critical aspects.

Methods for Various C/C++ Project Types

C Projects

For C projects, creating a CMake compilation database is recommended.

If this is not feasible with your build system, our project maker tool can be employed to determine project sources and include paths.

Alternatively, Build Monitor on Windows or Bear on Linux can be used to capture compilation commands.

Visual Studio Projects

CppDepend supports Visual Studio projects from 2010 to 2022, accommodating files with extensions like .sln, .vcproj, and .vcxproj.

CMake JSON Compilation Database

A compilation database acts as a central storage for compilation configurations, documenting the precise settings used during the compilation of a project's files.

This database can be created using tools such as CMake or Ninja, along with several other techniques for generating a compilation database as described here.

Qt Projects

For Qt projects, the preferred analysis method is to generate a CMake compilation database directly via the QtCreator IDE.

CLion Projects

Analyzing CLion projects is most effective when the compilation database is produced according to the specified method.

Source Folders

Our project maker tool allows you to define source folders and files, as well as set include paths.

Eclipse Projects

Effective Eclipse project analysis requires a compilation database, ideally created with Bear for Linux or Build Monitor for Windows.

In cases where build specifications are unattainable, our project maker tool can be utilized to define project sources and include paths.

SCon

For SCon projects, we recommend creating a compilation database by following the provided instructions.

Ninja

Generating a compilation database for Ninja projects is advised, as detailed in the specified method.

Makefile

Creating a compilation database with Bear on Linux or Build Monitor on Windows is suggested for Makefile projects.

If building a specification is not possible, our project maker tool can be used to outline project sources and include paths.

Other projects

For any C/C++ project, the ideal approach is to create a compilation database as detailed.

If this is not achievable, our project maker tool can be used to specify project sources and include paths.

Alternatively, Build Monitor on Windows or Bear on Linux can intercept compilation commands.

CppDepend offers a wide range of features. It is often described as a Swiss Army Knife for C and C++ developers.

Start Free Trial