Menu

using .cppcheck project file on Jenkins

2022-11-25
2022-11-28
  • Charles-the-intern

    Hello,
    I'm writing custom rules and now have compiled it into an executable. I'm integrating it into Jenkins, and my setup is as followed:
    - The binary .exe is pushed to the remote repo along with the codebase, and will be used to run (rather than dealing with adding it to PATH)
    - I use the .cppcheck project file to run, and specified the source files to run inside the <dir/> XML element (this works locally for me)
    - The Jenkins instance has Windows environment and I've defined a workspacews(my-workspace) and running cppcheck inside this my-workspace.

    I came across a problem where it emits out error "no C or C+ source file found", even though I 've verified that the path to the source file is correct. If I just make it simple without that project file and run cppcheck directly with that source file (same path) then it works... Does anyone come across this issue before or have an idea to resolve this?

    I can think of a workaround with a compile-command.json, but then there's an extra overhead of writing a script to generate this .json, and I'm afraid it might gives the same error as the setup above...

    Thank you very much!

     

    Last edit: Charles-the-intern 2022-11-25
  • Charles-the-intern

    I tried with compile_commands.json and it works perfectly... For anyone stumble across this problem in the future, use the compile command database approach

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.