In order to create a configuration file before the build-wrapper process, I first analysed it with the cmake .. -G "Unix Makefiles" command as a generator and then with the cmake .. -G "Visual Studio 17 2022" command. The result I got is as follows; Using Unix Makefiles, I found more than 450 code smells and 24 bugs in my source code. When I generated and analysed the same code with cmake .. (I did not specify the generator because the default Visual Studio 17 is 2022), it found only around 200 code smells and no bugs in the source code. What exactly is the reason for this difference?
My buildwrapper command is build-wrapper-linux-x86-64 --out-dir bw_output cmake --build Sonarqube_Analysis/ --config Release.
Would you be able to share the build-wrapper.log generated for each run? Without them, I can only provide guesses, so I would rather have a look to verify what may be going on.
In any case, without more information, I would advise using two separate build directories (one per generator) and making sure the build in both cases is done from scratch. Otherwise, some files may not need to be rebuilt, and they will not be seen by the build wrapper.
If the only thing that changed is the generator, I would expect the compiler flags to be the same in both cases, but I would suggest double-checking. Some files may be skipped from the analysis depending on the compiler flags (extensions). You can check if you see something like Microsoft extension activated by ... on your scanner logs.
For future reference, when using Unix Makefiles, cmake picked the right embedded gcc compiler, and the compilation succeeded. When using the Visual Studio generator, cmake picked Microsoft’s compiler, which would fail to compile the source code. Hence the disappearing issues.