FindLizard¶
Lizard is a cyclomatic complexity analysis tool. See https://github.com/terryyin/lizard/. This modules looks for Lizard and provides a function to add Lizard scans to the build system.
Result Variables¶
This module defines the following variables:
- Lizard_FOUND¶
True if Lizard is found, false if it is not.
- Lizard_VERSION¶
The version reported by
lizard --version
.
- Lizard_EXECUTABLE¶
The path to the Lizard program. This is an advanced cache variable.
Functions¶
- add_lizard_target¶
This function adds a custom target to run Lizard. The target is run in CMAKE_CURRENT_SOURCE_DIR.
add_lizard_target( name [ALL] [ARGUMENTS argument1 [argument2 ...]])
The
name
must be a unique target name.ALL
is passed on to the add_custom_target() command. UseARGUMENTS
to specify command line arguments for Lizard. IfARGUMENTS
is omitted, Lizard is run without any command line arguments.You can create multiple lizard targets. This supports the use case of scanning different parts of a project with different parameters. For example, you might be more lenient on the length of unit test cases than functions in your production code.
Here is an example:
find_package(Lizard) add_lizard_target( complexity_analysis ALL ARGUMENTS --CCN 10 --lenght 50 --warnings_only )