1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2 PROJECT(diagnostics LANGUAGES C)
3 SET(target ${PROJECT_NAME})
4 SET(dependency "glib-2.0 gio-unix-2.0 dlog dumpsys capi-system-info")
5 # ADD_DEFINITIONS(-Wall -Werror -Wextra)
9 pkg_check_modules(pkgs REQUIRED "${dependency}")
11 FOREACH(flag ${pkgs_CFLAGS})
12 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
14 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -Winline")
15 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
17 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
19 ADD_SUBDIRECTORY(src/library)
21 # cmocka tasts and coverage
22 option(ENABLE_COVERAGE "Measure the coverage and generate report" OFF)
23 option(ENABLE_TESTS "Run unit tests after build" ON)
24 if(ENABLE_TESTS OR ENABLE_COVERAGE)
25 FIND_PACKAGE(CMocka CONFIG REQUIRED)
28 INCLUDE_DIRECTORIES(${LIBCMOCKA_INCLUDE_DIR})
29 ADD_SUBDIRECTORY(src/test)
30 endif(ENABLE_TESTS OR ENABLE_COVERAGE)