Hey guys,
I’m trying to use sonar lint in VS 2022.
I know that there is an open ticket for CMakePresets but after migrating from Ninja to Ninja Multi the workaround posted here
does not seam to work any more (maybe I’m missing something)
Now the folder structure for multi config generators is a little bit different
for single config generatrors it looks like this
./build/presetName/compile_commands.json
./build/presetName/bin
However for multi config generators it looks like this
./build/presetName/compile_commands.json
./buildPresetName/bin/Debug
./buildPresetName/bin/Release
I’m using this CMakeSettings.json
{
"configurations": [
{
"name": "Foo",
"description": "This file is only necessary for SonarLint. SonarLint is not able to handle CMakePresets yet",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}/../build/myPresetName",
"installRoot": "${projectDir}/../build/myPresetName",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
}
]
}
This worked for single config generators
This is the sonarlint output is.
[CMake] Specified build configuration 'Windows and Ninja' could not be found in CMakeSettings.json
[CMake] Could not locate compilation database at ''. Make sure that your project is configured correctly.
See https://github.com/SonarSource/sonarlint-visualstudio/wiki for more information.
[CMake] Specified build configuration 'Windows and Ninja' could not be found in CMakeSettings.json
[CMake] Could not locate compilation database at ''. Make sure that your project is configured correctly.
See https://github.com/SonarSource/sonarlint-visualstudio/wiki for more information.
[CMake] Specified build configuration 'Windows and Ninja' could not be found in CMakeSettings.json
[CMake] Could not locate compilation database at ''. Make sure that your project is configured correctly.
See https://github.com/SonarSource/sonarlint-visualstudio/wiki for more information.
[CMake] Specified build configuration 'Windows and Ninja' could not be found in CMakeSettings.json
[CMake] Could not locate compilation database at ''. Make sure that your project is configured correctly.
See https://github.com/SonarSource/sonarlint-visualstudio/wiki for more information.
Unable to retrieve the configuration for file 'C:\git\myProject\app\t300\Simulation\FreeRTOS_main_Windows.c'.
Check the file is part of a supported project type in the current solution.
Could you help me out trying to get sonarlint to work for multi config generators? Thx guys
- Operating system: Windos 10
- IDE name and flavor/env: VS 2022
- SonarLint plugin version: 6.3.0.47195
- Is connected mode used: standalone