cppcheck/man/chapters/03-import-project.md

47 lines
1.1 KiB
Markdown
Raw Normal View History

2019-06-01 19:52:09 +02:00
# Importing project
You can import some project files and build configurations into Cppcheck.
## Cppcheck GUI project
You can import and use Cppcheck GUI project files in the command line tool:
cppcheck --project=foobar.cppcheck
## CMake
Generate a compile database:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
The file `compile_commands.json` is created in the current folder. Now run Cppcheck like this:
cppcheck --project=compile_commands.json
## Visual Studio
You can run Cppcheck on individual project files (\*.vcxproj) or on a whole solution (\*.sln)
Running Cppcheck on an entire Visual Studio solution:
cppcheck --project=foobar.sln
Running Cppcheck on a Visual Studio project:
cppcheck --project=foobar.vcxproj
## C++ Builder 6
Running Cppcheck on a C++ Builder 6 project:
cppcheck --project=foobar.bpr
## Other
If you can generate a compile database then it's possible to import that in Cppcheck.
In Linux you can use for instance the `bear` (build ear) utility to generate a compile database from arbitrary build tools:
bear make