That seemed to work great (I had to use -isystem rather than -system-include) I can tell CMake to add certain headers to the g++ system path by adding the "SYSTEM" keyword to "target_include_directories". This seems to be a good workaround. Thank you very much for your help
Sure, I'll give that a go. To clarify, do you mean: cppcheck --project=compile_commands.json -isystem-include path/to/third-party/ or cppcheck --project=compile_commands.json -i path/to/third-party/ ?
Sure, I'll give that a go. To clarify, do you mean: cppcheck --project=compile_commands.json -isystem-include path/to/third-party/ or cppcheck --project=compile_commands.json -ipath/to/third-party/ ?
Sure, I'll give that a go. To clarify, do you mean: cppcheck --project=compile_commands.json -isystem-include path/to/third-party/ or cppcheck --project=compile_commands.json -ipath/to/third-party/ ?
Hi Daniel, Thank you very much for your prompt response. I considered raising a question in the CMake GitLab project, however I realised that this issue is not specific to CMake. For example, other build systems can be configured to generate a compile_commands.json file (e.g. Bazel). The compile_commands.json file can then be used by cppcheck and the same issue would occur - "syntax errors" in 3rd party code would cause cppcheck to fail, therefore the "--suppress" workaround fails. I think your suggestion...
Hi, I am invoking cppcheck via CMake (https://cmake.org/cmake/help/latest/prop_tgt/LANG_CPPCHECK.html). CMake adds all include paths provided to the compiler (gcc) to the include path list of cppcheck (-I ...). Consequently, cppcheck analyses 3rd party includes. I would like to configure cppcheck to NOT analyse 3rd party includes. I tried adding the 3rd party includes as "-i " arguments, but that did not work. It is stated here that "excludes" are not honoured if they are also "includes". It would...
Hi, I am invoking cppcheck via CMake (https://cmake.org/cmake/help/latest/prop_tgt/LANG_CPPCHECK.html). CMake adds all include paths provided to the compiler (gcc) to the include path list of cppcheck (-I ...). Consequently, cppcheck analyses 3rd party includes. I would like to configure cppcheck to NOT analyse 3rd party includes. I tried adding the 3rd party includes as "-i " arguments, but that did not work. It is stated here that "excludes" are not honoured if they are also "includes". It would...