clang-tidy cmake exclude file from check

后端 未结 2 1477
别那么骄傲
别那么骄傲 2020-12-19 06:31

I have a dependency as source in my project that I have no control over. I\'m using cmake\'s clang-tidy integration to analyze my code, and this dependency is firing A LOT o

2条回答
  •  感情败类
    2020-12-19 07:06

    In case you have a header only library I use SYSTEM (should also be possible for OBJECT libraries)

    add_library(
      header_only_library_no_static_code_analysis 
      INTERFACE
    )
    
    target_include_directories(
      header_only_library_no_static_code_analysis 
      SYSTEM # Adds -isystem instead of -I and this tells clang-tidy not to analyze these includes
      INTERFACE
        path/to
    )
    

    I couldn't use this approach for a long time due to following bug

    https://bugs.launchpad.net/gcc-arm-embedded/+bug/1698539

    But with GNU Arm Embedded Toolchain Version 9-2020-q2-update it seems resolved :)

提交回复
热议问题