Tizen 2.1 base
[framework/pim/libaccounts-svc.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(accounts-svc C)
3
4 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
5 SET(EXEC_PREFIX "\${prefix}")
6 SET(LIBDIR "\${prefix}/lib")
7 SET(INCLUDEDIR "\${prefix}/include ")
8 SET(VERSION_MAJOR 0)
9 SET(VERSION "${VERSION_MAJOR}.2.21")
10
11 SET(SRCS
12 src/account.c
13 src/account-capability-parser.c
14 )
15
16 SET(TESTSRC
17 src/account.c
18 src/account-capability-parser.c
19 src/utc-account.c
20 )
21
22 SET(XML_PARSE_TEST_SRC
23 src/account.c
24 src/account-capability-parser.c
25 src/account-xml-verify.c
26 )
27
28 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
29
30 INCLUDE(FindPkgConfig)
31 pkg_check_modules(pkgs REQUIRED sqlite3 dlog db-util glib-2.0 capi-base-common vconf capi-appfw-application libxml-2.0)
32
33 FOREACH(flag ${pkgs_CFLAGS})
34         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
35 ENDFOREACH(flag)
36
37 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
38 SET(CMAKE_LDFLAGS "-Wl,-zdefs")
39
40 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
41 ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
42 ADD_DEFINITIONS("-DSLP_DEBUG")
43
44 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
45 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
46 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
47
48 ADD_EXECUTABLE("acctest" ${TESTSRC})
49
50 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
51 TARGET_LINK_LIBRARIES("acctest" ${pkgs_LDFLAGS})
52
53 ADD_EXECUTABLE("account-xml-verify" ${XML_PARSE_TEST_SRC})
54 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
55 TARGET_LINK_LIBRARIES("account-xml-verify" ${pkgs_LDFLAGS})
56
57 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
58
59 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/accounts-svc)
60 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
61 INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
62
63 INSTALL(TARGETS account-xml-verify DESTINATION bin)
64
65 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account.h DESTINATION include)
66 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-error.h DESTINATION include)
67 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-types.h DESTINATION include)
68
69 #ADD_SUBDIRECTORY(test)