I’m using set(CMAKE_C_CPPCHECK "....;--output-file=cppcheck_output.txt")
to capture the result of the run in one signe file. In many cases, this works well, but occasionally the output file is corrupted. It seem the root problem here is, that since CMake uses multiple threads to compile the sources, cppcheck is also invoked multiple times in parallel. Check finding to the output file is not appended atomically, thus the output gets intermixed then and that results in a non-parsable file then
What is the recommended way avoid this? Serializing the build is not really an option. Is there an easy way to use a target-specific cppcheck output file and then merge all these files? Or force the cppcheck to run serialized?
Thanks, Axel