clang-tidy cmake exclude file from check

故事扮演 提交于 2019-12-05 20:33:09

If some property - like CXX_CLANG_TIDY - is only available on target level, you have to move the files you want to have different settings for into a separate new target itself.

This can be done by using OBJECT libraries.

In your case something like:

add_library(
    target_no_static_code_analysis
    OBJECT
        path/to/file.cpp
        path/to/file.h
)

# NOTE: Resetting only needed if you have a global CMAKE_CXX_CLANG_TIDY
set_target_properties(
    target_no_static_code_analysis
    PROPERTIES
         CXX_CLANG_TIDY ""
)

...
add_library(target ${other_srcs} $<TARGET_OBJECTS:target_no_static_code_analysis>)

References

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!