/iwyu-target-cmake

CMake integration for include-what-you-use

Primary LanguageCMakeMIT LicenseMIT

Include-What-You-Use CMake Targets

CMake macro to add per-source level checks on individual targets for include-what-you-use violations

Status

Travis CI (Ubuntu) AppVeyor (Windows) Coverage Biicode Licence
Travis AppVeyor Coveralls Biicode License

Description

iwyu-target-cmake can be used to scan individual source files for include-what-you-use violations. The check is added to target and automatically run over all of it its source files.

Usage

include-what-you-use-target-cmake works by scanning source files for #include statements and then checks the passed include directories for files matching the name of files specified in the #include statements.

Checking a target

iwyu_target_sources

Examine the sources attached to TARGET for include-what-you-use violations. The compiler flags as indicated in the arguments are passed to include-what-you-use to determine whether or not included files are not necessary.

  • TARGET: Target to check
  • [Optional] CHECK_GENERATED: Also check generated files, off by default.
  • [Optional] WARN_ONLY: Don't abort the build on violations, just warn.
  • [Optional] FORCE_LANGUAGE: Treat source files for this target as either C or CXX.
  • [Optional] EXTERNAL_INCLUDE_DIRS: System-level include directories (will not be transitively examined).
  • [Optional] INTERNAL_INCLUDE_DIRS: Include directories in this project (will be transitively examined).
  • [Optional] DEFINES: Definitions to set when preprocessing.
  • [Optional] CPP_IDENTIFIERS: Identifiers which indicate that a header file scanned is always C++.
  • [Optional] DEPENDS: Targets to run or source files to generate before checking the sources for violations.