From a7553e883f223aa517ef6fe37f53a5ac76fcd208 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Fri, 10 Jun 2022 13:43:39 -0400 Subject: [PATCH] CMakeLists.txt - Add 'scan-build' to tests if the application is installed --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 632947f..542edd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,3 +24,16 @@ target_include_directories(tests PUBLIC ${CHECK_INCLUDE_DIRS}) target_compile_options(tests PUBLIC ${CHECK_CFLAGS_OTHER}) add_test(NAME tests COMMAND $) + + +find_program(SCAN_FOUND scan-build) + +if (SCAN_FOUND) + add_test( + NAME clang_static_analysis + COMMAND scan-build make + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +else() + MESSAGE(STATUS "scan-build not found, not scanning code") +endif()