1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 13:41:13 +02:00

Add static analyser support (#41)

* add static analyzers

* use 'ON/OFF' for Ccache settings
This commit is contained in:
Lars Melchior 2020-06-03 10:29:12 +02:00 committed by GitHub
parent ecc71786e5
commit 9ede321e5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 6 deletions

View file

@ -10,14 +10,40 @@ include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)
# enables sanitizers support using the the `USE_SANITIZER` flag
# available values are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'
if (USE_SANITIZER)
if (USE_SANITIZER OR USE_STATIC_ANALYZER)
CPMAddPackage(
NAME StableCoder-cmake-scripts
GITHUB_REPOSITORY StableCoder/cmake-scripts
GIT_TAG 3a469d8251660a97dbf9e0afff0a242965d40277
GIT_TAG 3d2d5a9fb26f0ce24e3e4eaeeff686ec2ecfb3fb
)
include(${StableCoder-cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
if (USE_SANITIZER)
include(${StableCoder-cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
endif()
if (USE_STATIC_ANALYZER)
if ("clang-tidy" IN_LIST USE_STATIC_ANALYZER)
SET(CLANG_TIDY ON CACHE INTERNAL "")
else()
SET(CLANG_TIDY OFF CACHE INTERNAL "")
endif()
if ("iwyu" IN_LIST USE_STATIC_ANALYZER)
SET(IWYU ON CACHE INTERNAL "")
else()
SET(IWYU OFF CACHE INTERNAL "")
endif()
if ("cppcheck" IN_LIST USE_STATIC_ANALYZER)
SET(CPPCHECK ON CACHE INTERNAL "")
else()
SET(CPPCHECK OFF CACHE INTERNAL "")
endif()
include(${StableCoder-cmake-scripts_SOURCE_DIR}/tools.cmake)
clang_tidy(${CLANG_TIDY_ARGS})
include_what_you_use(${IWYU_ARGS})
cppcheck(${CPPCHECK_ARGS})
endif()
endif()
# enables CCACHE support through the USE_CCACHE flag