Add source properties to skip linting (clang-tidy, iwyu, etc.)
In a recent project, I encountered a situation where vendored sources were added to an existing target, but those vendored sources had various issues that clang-tidy, iwyu, etc. complain about. I wanted to disable those checks just for the vendored sources, but at the moment CMake only supports enabling/disabling them at the target level. My only solution is to split up the target, but that has strong negative implications for installing those targets and how other projects consume them.
I propose we add source properties analogous to the SKIP_AUTOGEN
family of properties to provide file-level control. I suggest the following new source file properties:
SKIP_LINT_CLANG_TIDY
SKIP_LINT_INCLUDE_WHAT_YOU_USE
SKIP_LINT_CPPCHECK
SKIP_LINT_CPPLINT
SKIP_LINT_ALL
I think that covers all the linting tools we support through target properties (<LANG>_CLANG_TIDY
, <LANG>_INCLUDE_WHAT_YOU_USE
, <LANG>_CPPCHECK
and <LANG>_CPPLINT
). I can't comment on the complexity of implementing this, but conceptually at least, this describes the API that ideally we could support.