From 5d62d1b53579247d4a44792ad1da8eeedfdb6dd0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 30 Jan 2016 16:38:29 +0100 Subject: clang analyze target --- CMakeLists.txt | 14 ++++++++++++++ common/CMakeLists.txt | 2 ++ 2 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fa2c09..d60e7d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,20 @@ function(generate_flatbuffers _target) endforeach(fbs) endfunction(generate_flatbuffers) +add_custom_target(analyze) +function(add_clang_static_analysis target) + get_target_property(SRCs ${target} SOURCES) + get_target_property(INCLUDEs ${target} INCLUDE_DIRECTORIES) + add_library(${target}_analyze OBJECT EXCLUDE_FROM_ALL ${SRCs}) + set_target_properties(${target}_analyze PROPERTIES + COMPILE_OPTIONS "--analyze" + EXCLUDE_FROM_DEFAULT_BUILD true + INCLUDE_DIRECTORIES "${INCLUDEs};/work/install/include/KF5/" # Had to hardcode include directory to find KAsync includes + COMPILE_FLAGS "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}" # Necessary to get options such as fPic + ) + add_dependencies(analyze ${target}_analyze) +endfunction() + set(CMAKE_AUTOMOC ON) add_definitions("-Wall -std=c++0x -g") include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${FLATBUFFERS_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/common) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a80ef95..cb7bb35 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -97,6 +97,8 @@ target_link_libraries(${PROJECT_NAME} ${storage_LIBS} KF5::Async) install(TARGETS ${PROJECT_NAME} EXPORT SinkCommonTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) +add_clang_static_analysis(${PROJECT_NAME}) + install(FILES clientapi.h domain/applicationdomaintype.h -- cgit v1.2.3