-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
+PROJECT(privilege-info VERSION 0.0.7 LANGUAGES C)
-SET(CMAKE_VERBOSE_MAKEFILE OFF)
+INCLUDE(GNUInstallDirs)
+INCLUDE(FindPkgConfig)
-IF("${USE_AUTOSTART}" STREQUAL "1")
- ADD_DEFINITIONS("-DUSE_AUTOSTART")
-ENDIF()
+IF(NOT CMAKE_BUILD_TYPE)
+ SET(CMAKE_BUILD_TYPE "RELEASE")
+ENDIF(NOT CMAKE_BUILD_TYPE)
-ADD_DEFINITIONS("-DCLIENT_IPC_THREAD")
-ADD_DEFINITIONS("-DUSE_IPC_EPOLL")
+IF(NOT DEFINED COVERAGE_DIR)
+ SET(COVERAGE_DIR
+ "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}-coverage"
+ CACHE PATH
+ "Read-only coverage data directory")
+ENDIF(NOT DEFINED COVERAGE_DIR)
+ADD_DEFINITIONS("-DCOVERAGE_DIR=\"${COVERAGE_DIR}\"")
-ADD_DEFINITIONS("-Werror -Wall -Wextra")
+SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
+SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -DNDEBUG")
+SET(CMAKE_C_FLAGS_COVERAGE "-std=c11 -O0 -ggdb --coverage -Wp,-U_FORTIFY_SOURCE")
-STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
-ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
+ADD_DEFINITIONS("-Werror")
+ADD_DEFINITIONS("-Wall")
+ADD_DEFINITIONS("-Wextra")
-CONFIGURE_FILE(privilege-info.pc.in privilege-info.pc @ONLY)
+SET(CMAKE_POSITION_INDEPENDENT_CODE "True")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
+PKG_CHECK_MODULES(PRIVILEGE_INFO_DEPS REQUIRED
+ glib-2.0
+ dlog
+ security-privilege-manager
+ capi-base-common
+ capi-system-info)
+
+INCLUDE_DIRECTORIES(SYSTEM ${PRIVILEGE_INFO_DEPS_INCLUDE_DIRS})
+LINK_DIRECTORIES(${PRIVILEGE_INFO_DEPS_LIBRARY_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
-MESSAGE("build privilege-info")
ADD_SUBDIRECTORY(src)
-MESSAGE("build tc-privilege-info")
ADD_SUBDIRECTORY(test)