Added ability to use cppcheck from the command line.
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 28 May 2013 18:54:46 +0000 (21:54 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 13 Jun 2013 15:10:16 +0000 (17:10 +0200)
commit58df55650cc675d95af2966a432f04594069eb2f
tree4876afd4216fd288862be40d55ae6d92c1ec7e81
parent64bc37468301c4e72dcce4ebfe576c54e71f3309
Added ability to use cppcheck from the command line.

CMake now detects cppcheck, and enables "make cppcheck" to run
cppcheck on all source files, generated kernels and some other files
excluded.  Commands are more or less the same as used in Jenkins.
A separate target is produced for each input file, allowing one to use
build system parallelism (tested that it doesn't have much effect on the
overall run time).  This also adds a nice property that after the
initial run, cppcheck gets only run on modified files.  All errors
(including those from unmodified files) are also collected into a single
text file for easier processing.

No effort has been made to make it particularly robust or portable,
e.g., with respect to different cppcheck versions, as it is mostly for
developer convenience to be able to reproduce the runs from Jenkins.

Ideally, Jenkins would also run cppcheck using the generated rules,
which would allow changing the cppcheck configuration in sync with
source code changes if that is necessary.  For this purpose, a CMake
option to switch to XML output files is provided.

Change-Id: Ib88e2ba87cd4f091484fe09beac5ef108b0fad77
tests/.gitignore [new file with mode: 0644]
tests/CMakeLists.txt
tests/CppCheck.cmake [new file with mode: 0644]