OrangesCppcheck¶
Provides functions to set up the cppcheck static analysis tool.
Configure cppcheck for a target¶
- oranges_enable_cppcheck¶
oranges_enable_cppcheck (<target> [ENABLE <checks...>] [DISABLE <checks...>] [EXTRA_ARGS <args...>] [LANGS <C|CXX>...])
Configures cppcheck for the given <target>
by manipulating the target’s <LANG>_CPPCHECK
properties.
If the CPPCHECK_OFF
variable is set to ON
, this function does nothing.
Options:
ENABLE
A list of checks to enable for this target. If not specified, the value of the
CPPCHECK_ENABLE
variable will be used.DISABLE
A list of checks to disable for this target. If not specified, the value of the
CPPCHECK_DISABLE
variable will be used.EXTRA_ARGS
A list of extra arguments to pass to cppcheck verbatim. If not specified, the value of the
CPPCHECK_EXTRA_ARGS
variable will be used.LANGS
Languages for which to enable cppcheck. Valid values are
C
orCXX
. If no languages are specified, this function will configure cppcheck for both valid languages.
Configure cppcheck globally¶
- oranges_create_cppcheck_target¶
oranges_create_cppcheck_target ([ENABLE <checks...>] [DISABLE <checks...>] [EXTRA_ARGS <args...>])
Creates a custom target named cppcheck
that executes cppcheck
over the entire source tree.
If the CPPCHECK_OFF
variable is set to ON
, this function does nothing.
Note that all arguments are optional. Options:
ENABLE
A list of checks to enable. If not specified, the value of the
CPPCHECK_ENABLE
variable will be used.DISABLE
A list of checks to disable. If not specified, the value of the
CPPCHECK_DISABLE
variable will be used.EXTRA_ARGS
A list of extra arguments to pass to cppcheck verbatim. If not specified, the value of the
CPPCHECK_EXTRA_ARGS
variable will be used.
Cache variables¶
- CPPCHECK_PROGRAM¶
Path to the cppcheck executable, used by oranges_enable_cppcheck()
.
An environment variable with this name may also be set.
- CPPCHECK_ENABLE¶
A space-separated list of default cppcheck checks to be enabled with calls to oranges_enable_cppcheck()
that do not
explicitly list their own desired checks. The environment variable with this name, if set, will initialize this variable’s value;
otherwise, a default set of checks will be enabled.
- CPPCHECK_DISABLE¶
A space-separated list of default cppchecks checks to be disabled with calls to oranges_enable_cppcheck()
that do not
explicitly list their own desired disabled checks. The environment variable with this name, if set, will initialize this variable’s value;
otherwise, a default set of checks will be disabled.
- CPPCHECK_EXTRA_ARGS¶
A list of space-separated arguments that will be passed to cppcheck verbatim in calls to oranges_enable_cppcheck()
.
The environment variable with this name, if set, will initialize this variable’s value; otherwise, defaults to --inline-suppr
.
- CPPCHECK_OFF¶
When this variable is set to ON
, calls to oranges_enable_cppcheck()
do nothing. The environment variable with this name,
if set, will initialize this variable; otherwise, defaults to OFF
.
Environment variables¶
- CPPCHECK_PROGRAM¶
Initializes the value of the CPPCHECK_PROGRAM
variable.
- CPPCHECK_ENABLE¶
Initializes the CPPCHECK_ENABLE
variable.
- CPPCHECK_DISABLE¶
Initializes the CPPCHECK_DISABLE
variable.
- CPPCHECK_EXTRA_ARGS¶
Initializes the CPPCHECK_EXTRA_ARGS
variable.
- CPPCHECK_OFF¶
Initializes the CPPCHECK_OFF
variable.
See also
- Module
OrangesClangTidy
Module for clang-tidy
- Module
OrangesCpplint
Module for cpplint
- Module
OrangesIWYU
Module for include-what-you-use
- Module
OrangesStaticAnalysis
Aggregate module for enabling all static analysis tools