Different targets in one project

SonarQube: Version 9.9
Scanner: build-wrapper, version 6.41 (win-x86-64)
Plugin: CFamily plugin version: 6.41

Hi!

I have two scenarios:

  1. A repository with C code that builds for different targets.
  2. A repository with a project divided into folders, where each part should be built separately.

Is there a way to analyze the code in these scenarios using a single project in SonarQube? I don’t want to create a separate project for each target or folder. If there is a build-wrapper configuration that could achieve this, that would be great.

I’ve heard about using portfolios and applications in SonarQube but I’m not sure if they would help. I also saw something about using branches for each condition, but it seems messy.

Can you help?

Hey there.

I think what you want is Analyzing several code variants, which became available in SonarQube v10.1. The latest active version is v10.6.

We also published a blog here: Working with Multiple Code Variants in C++

In SonarQube v9.9, you are limited to the branch approach or creating many projects.

Thanks, Colin!
So, I’ll wait for my company to update our Sonarqube version.