eb3a814438410e6bf7b295e99adc8cd1e62f8293
[platform/core/connectivity/bluetooth-frwk.git] / bt-otp / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(bt-otp C)
3
4 SET(SRCS bt-otpserver.c)
5
6 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
7         SET(CMAKE_BUILD_TYPE "Release")
8 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
9
10 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
11
12 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
13
14 SET(PKG_MODULES
15         dbus-glib-1
16         gio-2.0
17         pkgmgr
18         eventsystem
19         dbus-1
20 )
21
22 INCLUDE(FindPkgConfig)
23 pkg_check_modules(otp_pkgs REQUIRED ${PKG_MODULES})
24
25 FOREACH(flag ${otp_pkgs_CFLAGS})
26         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall")
27 ENDFOREACH(flag)
28
29 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
30 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
31 SET(CMAKE_C_FLAGS_RELEASE "-O2")
32 SET(APP_SYSCONFDIR /opt/var/lib/bluetooth)
33
34 FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool)
35
36 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
37
38 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
39 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${otp_pkgs_LDFLAGS} -L${CMAKE_CURRENT_SOURCE_DIR}/../bt-api -lbluetooth-api)
40
41 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
42 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.otp.service DESTINATION share/dbus-1/system-services)
43
44 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-otp.conf DESTINATION /etc/dbus-1/system.d)
45
46 SET(PREFIX ${CMAKE_INSTALL_PREFIX})