Skip to content

Commit

Permalink
fix: add checks for target_disable_static_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
abeimler committed Jul 3, 2022
1 parent 9335aa7 commit 2d680c9
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/StaticAnalyzers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,20 @@ endmacro()

# Disable clang-tidy for target
macro(target_disable_clang_tidy TARGET)
set_target_properties(${TARGET} PROPERTIES C_CLANG_TIDY "")
set_target_properties(${TARGET} PROPERTIES CXX_CLANG_TIDY "")
find_program(CLANGTIDY clang-tidy)
if(CLANGTIDY)
set_target_properties(${TARGET} PROPERTIES C_CLANG_TIDY "")
set_target_properties(${TARGET} PROPERTIES CXX_CLANG_TIDY "")
endif()
endmacro()

# Disable cppcheck for target
macro(target_disable_cpp_check TARGET)
set_target_properties(${TARGET} PROPERTIES C_CPPCHECK "")
set_target_properties(${TARGET} PROPERTIES CXX_CPPCHECK "")
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
set_target_properties(${TARGET} PROPERTIES C_CPPCHECK "")
set_target_properties(${TARGET} PROPERTIES CXX_CPPCHECK "")
endif()
endmacro()

# Disable vs analysis for target
Expand All @@ -187,7 +193,9 @@ endmacro()

# Disable static analysis for target
macro(target_disable_static_analysis TARGET)
target_disable_clang_tidy(${TARGET})
target_disable_cpp_check(${TARGET})
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
target_disable_clang_tidy(${TARGET})
target_disable_cpp_check(${TARGET})
endif()
target_disable_vs_analysis(${TARGET})
endmacro()

0 comments on commit 2d680c9

Please sign in to comment.