How to prevent clang-tidy to check sources added with FetchContents?

CMake 3.25 is adding a new SYSTEM target property. It is initialised from a corresponding SYSTEM directory property, and both add_subdirectory() and FetchContent_Declare() are gaining an associated SYSTEM keyword as well. I’m starting to wonder if we may want to disable all linters, checkers and verification tasks on targets that have their SYSTEM property set to true.

Maybe we could have a dedicated target property for whether checkers should be enabled in case someone wants to enable checking on a target marked SYSTEM. We could fall back to the SYSTEM property if that dedicated property isn’t set.

I haven’t thought this through, nor have an appreciation for how easy or hard it would be to implement, but it seemed worth mentioning for further discussion.

2 Likes