SonarLint - More compiler support in CMake projects (gcc, clang, arm gcc cross-compiler)


As i see the new CMake integration is limited only for Visual studio MSVC C/C++compiler.

If i try to use any other compiler in VS2019 for example IoT-Debug (arm gcc cross-compiler) or x64-Clang-Debug (clang) i got the following messages.

[CFamily Analysis] Unsupported configuration: 'C:\PROGRA~2\MIB055~1\2019\PROFES~1\Linux\gcc_arm\bin\AR10B2~1.EXE'
is not a supported compiler.
[CFamily Analysis] Unsupported configuration: 'c:\PROGRA~2\MIB055~1\2019\PROFES~1\VC\Tools\Llvm\x64\bin\clang-cl.exe'
is not a supported compiler.

Can you plan to support any other compiler in CMake SonarLint checking in future? I tried to use any custom mingw or linaro cross-compiler gcc configuration, but they had the some problem.

Hi @Livius and welcome to our community.

You are indeed right. For now, we do not support any other compiler in Visual Studio than MSVC.
I take good note of your request and I add this feature to our backlog of features.

In the meantime, support for C and C++ in SonarLint in VS Code is coming soon. Would you consider this as an alternative?

Thanks the quick information. I would like to use it for C/C++ Linux cross compiling in CMake. I could configure Visual Studio Professional’s CMake project to use any self-installed cross compiler gcc, i could do that same in VS Code too, it is working. For short time C/C++ SonarLint can be interesting for me in VS Code too, but only if it can support any kind of compiler not just MSVC.

As i understand your current implementation can use CMAKE_EXPORT_COMPILE_COMMANDS to generate a json which is fine to do any analysing. Probably it is the good way in VS Code too, but it would be really important to implement it in compiler independent mode, then later this is what could need in Visual Studio Professional, too.

I can confirm that SonarLint for VS Code is expected to support all the compilers that our C++ analyzer can support. It will not be limited to MSVC.

Can you implement this new VSCode CMake project C and C++ code analyzer for Visual Studio Professional 2019/2022, too? In Visual Studio Professional it is limited for MSVC compiler only but in VSCode it is nicely work for any custom configured ARM cross-compiler gcc, too.

There is no short-term plan to do so.
We keep recording interest though.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.