build option change
[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.41")
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 pkgmgr-info aul)
32
33 FOREACH(flag ${pkgs_CFLAGS})
34         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
35 ENDFOREACH(flag)
36
37 FIND_PROGRAM(UNAME NAMES uname)
38 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
39 IF ("${ARCH}" STREQUAL "arm")
40         ADD_DEFINITIONS("-DTARGET_ARM")
41         MESSAGE("[TARGET] Compile")
42 ELSE  ("${ARCH}" STREQUAL "arm")
43         ADD_DEFINITIONS("-DTARGET_I386")
44         MESSAGE("[i386] Compile")
45 ENDIF ("${ARCH}" STREQUAL "arm")
46
47 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
48 SET(CMAKE_LDFLAGS "-Wl,-zdefs")
49
50 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
51 ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
52 ADD_DEFINITIONS("-DSLP_DEBUG")
53
54 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
55 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
56 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
57
58 ADD_EXECUTABLE("acctest" ${TESTSRC})
59
60 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
61 TARGET_LINK_LIBRARIES("acctest" ${pkgs_LDFLAGS})
62
63 ADD_EXECUTABLE("account-xml-verify" ${XML_PARSE_TEST_SRC})
64 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
65 TARGET_LINK_LIBRARIES("account-xml-verify" ${pkgs_LDFLAGS})
66
67 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
68
69 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/accounts-svc)
70 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
71 INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
72
73 INSTALL(TARGETS account-xml-verify DESTINATION bin)
74
75 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account.h DESTINATION include)
76 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-error.h DESTINATION include)
77 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-types.h DESTINATION include)
78
79 #ADD_SUBDIRECTORY(test)