Is there a possibility to get one report for all modules from the project? I tried many different configurations but none of them worked.
I think the answer at the time of this writing is no.
There's a relevant discussion on the CMake discourse site:
parallel cppcheck invocation corrupts common output file, which links to this feature-request on Kitware's GitLab: Support file specifc properties for CMAKE__CPPCHECK #22020, which depends on Introduce SOURCE_FILE_PROPERTY generator expression that operates on properties of source files #21986, which (if I understand correctly) seems to imply that the next step in getting what you want isn't fully what you want, and instead will be getting one cppechck output file per source file to compile (based on a source file property like LOCATION
).
Note: CMake runs analysis tools per-source file instead of invoking them with batches of source file, which I think is a good thing, since it leverages the generated buildsystem to avoid re-running analysis for files which don't need to be re-built. You can confirm that yourself if you look at the source code of what CMake generates for various buildsystems (for example, cmMakefileTargetGenerator::WriteObjectRuleFiles
and cmNinjaTargetGenerator::WriteCompileRule
).
It wouldn't be difficult to write a custom command using the build events signature of add_custom_command
to concatenate all those output files into one file at the end of building a target, though. You could use the built-in cmake -E cat
commandline command, or write and run a CMake script that gets a list of files under the common output directory, reads them, concatenates them, and writes the output to a file.