Explorar o código

CMakeLists.txt - Add 'scan-build' to tests if the application is installed

Chris Morgan %!s(int64=3) %!d(string=hai) anos
pai
achega
a7553e883f
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      CMakeLists.txt

+ 13 - 0
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 $<TARGET_FILE:tests>)
+
+
+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()