PricingDownload
Product

Platform

All features48 capabilities, from IDE to CICompliance KitsISO 26262, DO-178C, IEC 62304...AI GovernanceControl AI-generated C/C++ codeWhat’s new in 2027Latest version highlightsScreenshotsSee the product in action

Analyze & improve

Coding standardsMISRA, CERT, CWE, AUTOSARArchitecture & dependenciesGraphs, matrix, cyclesSBOM & dependenciesIs our C++ code affected? Minutes, not weeksTechnical debtMeasured in hours and dollarsQuality gatesStop regressions in CISmart Code CityYour codebase in 3D

Integrations

IDE pluginsVisual Studio, VS Code, CLion...CI/CD pipelinesJenkins, Azure DevOps, GitHub, GitLabSonarQube pluginC/C++ results in SonarQubeExternal analyzersClang-Tidy, Cppcheck, coverageFeature on Demand
Solutions

By need

Functional safetyCompliance kits per standardCoding standardsMISRA, CERT, AUTOSAR, ISO...Legacy modernizationRefactor large C/C++ safelyCode auditExpert review of your codebaseM&A due diligenceAssess technical health fast

By role

DevelopersSoftware architectsTech leadsDevOps engineersEngineering managersProject managers

CTOsCIOs / IT leadersQA engineersSecurity leadersComplianceConsultantsRequest a guided PoC
Industries

Safety-critical

AutomotiveISO 26262, MISRA, AUTOSARAerospace & DefenseDO-178C programsMedical DevicesIEC 62304 softwareEnergy & UtilitiesIEC 61508 systemsEmbedded SystemsFirmware and devices

Enterprise

Financial ServicesTrading and paymentsGame DevelopmentEngines and large C++Software VendorsCommercial C/C++ productsGovernmentAgencies and contractorsAll industries & case studies
Resources

Learn

DocumentationGuides, rules and CI setupKnowledge baseFrequently asked questionsBlogC and C++ code quality articlesRelease notesEvery version since 2009

Customers

Case studiesSuccess storiesTestimonialsWhat users sayOur customersCompanies using CppDependGold Code QualityOpen source projects we rate

Programs & company

Feature on DemandMissing features built for freeFree for open sourceLicenses for OSS and studentsContact usSales and supportEULALicense agreement
Docs
Documentation

CI/CD Integration

CppDepend in GitLab CI/CD

Analyze your C/C++ code on every merge request, fail the pipeline on new critical issues, and publish the HTML report where the team reads it.

6 min readCI/CD IntegrationCppDepend 2027

How it works

GitLab only has to start the CppDepend command line tool. It reads the .cdproj project, analyzes the code, evaluates the rules and quality gates, and writes the results and the HTML report to an output folder. The exit code tells GitLab whether the gates passed.

1 Commitpush or merge request
2 Buildoptional, if the analysis needs binaries
3 AnalyzeCppDepend console
4 Gatenon-zero exit code fails the job
5 Publishartifacts and GitLab Pages

Prerequisites

  • A GitLab Runner that can run CppDepend. CppDepend.Console.exe is a Windows executable, so use a Windows runner (shell executor with PowerShell is the simplest).
  • CppDepend installed on that runner, for example in C:\Program Files\CppDepend, with a valid license for CI use.
  • A .cdproj project file committed to the repository (see the next step).
  • Runner tags so that only the right machines pick the job, for example windows and cppdepend.
Linux runnersOnly use a Linux runner if your CppDepend package contains a Linux console build. This page covers the Windows console.

1 Create the project file

Create the project once in the CppDepend GUI (VisualCppDepend): choose the source folders, the build outputs and the rules, then save the .cdproj. Commit it next to your sources, for example at the root of the repository.

  • The path of the project file given on the command line must be absolute (relative paths are not supported). In the pipeline, build it from $CI_PROJECT_DIR.
  • If the paths stored in the project differ from the runner workspace, override the source location with /InDirs and the output location with /OutDir.
  • The GUI Launchpad also has a GitLab CI card that generates a starter job. Use it as a starting point and compare with the job below.

2 The pipeline job

Add this to .gitlab-ci.yml. It runs the analysis, keeps the whole output folder as an artifact, and stops the job with the exit code of CppDepend.

.gitlab-ci.yml
stages:
  - analyze
  - publish

variables:
  CPPDEPEND_EXE: 'C:\Program Files\CppDepend\CppDepend.Console.exe'
  PROJECT_FILE:  '$CI_PROJECT_DIR\MyApp.cdproj'
  OUT_DIR:       '$CI_PROJECT_DIR\CppDependOut'

cppdepend:
  stage: analyze
  tags: [windows, cppdepend]
  script:
    - '& "$env:CPPDEPEND_EXE" "$env:PROJECT_FILE" /InDirs "$env:CI_PROJECT_DIR" /OutDir "$env:OUT_DIR" /Silent'
    - 'if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }'
  artifacts:
    when: always            # keep the report even when a quality gate fails
    expire_in: 30 days
    paths:
      - CppDependOut/
    expose_as: 'CppDepend report'
Why when: alwaysThe report is most useful when the job fails. Without it GitLab drops the artifacts of a failed job.

3 Fail the pipeline on quality gates

CppDepend returns zero on success and a non-zero code when a quality gate fails, so GitLab fails the job without extra work. Define the gates in the project, for example no new critical issues and coverage must not decrease, so legacy issues do not block the team.

Warn instead of failing

To mark the job as a warning (orange) while the team is getting used to the gates, allow the gate exit code:

.gitlab-ci.yml
cppdepend:
  allow_failure:
    exit_codes: 1
Check the exit codeThe CppDepend documentation says only that a failed quality gate returns non-zero. Run a failing analysis once on your runner, read $LASTEXITCODE in the job log, and use that value in exit_codes. Do not ignore every exit code: that also hides real analysis errors.

4 Publish the report

Option A: job artifacts

With expose_as set (see step 2), merge requests show a CppDepend report link that opens the artifact browser. Download the folder or browse to the HTML report.

Option B: GitLab Pages for the default branch

Publish the report of the main branch as a small internal site that anyone with access can open.

.gitlab-ci.yml
pages:
  stage: publish
  tags: [windows]
  needs: [cppdepend]
  script:
    - 'New-Item -ItemType Directory -Force public | Out-Null'
    - 'Copy-Item -Recurse -Force CppDependOut\* public'
  artifacts:
    paths:
      - public
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Access controlThe report contains file names, code excerpts and metrics of your project. Restrict Pages visibility to project members (Settings, General, Visibility) if the repository is private.

Custom reports

Custom reports created with the Report Designer are written at the end of the analysis into the output folder (ReportTemplates and the Report_<name>.html files). They are included by the artifact path above.

5 Run on merge requests

Analyze merge request pipelines and the default branch, and skip everything else, to keep runner time low:

.gitlab-ci.yml
workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

Combined with quality gates that look at new issues only, a merge request is blocked only by what the change itself introduced.

6 Baseline and trends

CppDepend separates new issues from the legacy baseline and shows trends against it, which needs the results of a previous analysis. A fresh GitLab workspace does not have them, so keep them between pipelines:

  • Persistent output folder on the runner. Pass a fixed path such as D:\cppdepend\myapp to /OutDir. Every run then compares with the previous result. Simple, but one runner machine is shared by all branches.
  • Artifact of the default branch. Download the results of the last successful default-branch pipeline into OUT_DIR before the analysis (job needs with artifacts: true from a scheduled pipeline, or the jobs API).
Verify on your setupWhich files of the output folder are read as the baseline depends on the baseline settings of your project. Run two analyses in a row on the runner and check that the second report shows trends before relying on this in a merge request gate.

Security

  • Store license keys and tokens as masked, protected CI/CD variables. Never commit them to the repository or print them in the job log.
  • Run the job on runners you control. The analysis reads the full source tree.
  • Artifacts and Pages contain code information: set expiry (expire_in) and visibility on purpose.

Console options

First argument: the absolute path of the .cdproj file, in double quotes when it contains spaces.

OptionEffect
/SilentNo console output and no calls to Console.Read(). Recommended in CI.
/OutDir dirOverrides the output folder of the project. Absolute path.
/InDirs dirOverrides the source location, for example the GitLab workspace.
/FullAnalysisRuns the full analysis.
/LogTrendMetricsForces the logging of trend metrics.
/XslForReport fileBuilds the report with your own XSL file. Absolute path.
/EmitVisualNDependBinXmlWrites VisualCppDepend.bin.xml, an XML file of the dependency graph.
/ViewReportOpens the HTML report. For local runs, not for CI.
/HideConsoleHides the console window.
/HelpPrints the help.

Troubleshooting

SymptomLikely cause and fix
Job stays pendingNo runner with the windows / cppdepend tags is online. Check Settings, CI/CD, Runners.
Project not foundThe project path must be absolute. Build it from $CI_PROJECT_DIR, and quote it.
Analysis finds no codePaths stored in the project do not exist in the runner workspace. Pass /InDirs.
Job fails but the report looks fineA quality gate failed. Open the Quality Gates page of the report. Use allow_failure: exit_codes only if you accept it.
No report in the merge requestArtifacts need when: always for failed jobs and a path that exists: check that /OutDir and artifacts:paths match.
No trends, everything is newThe previous results are not available in the workspace. See Baseline and trends.
Backslash problems in the YAMLUse single quotes around Windows paths and PowerShell commands, as in the examples.
Was this page helpful?
Evaluating CppDepend on a production codebase?Get a guided proof of concept with our static analysis architects.
Request a PoC