2.0_alpha release commit
[framework/messaging/email-service.git] / email-api / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(email-api)
3
4 SET(CMAKE_SKIP_BUILD_RPATH TRUE)
5
6 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
7         SET(CMAKE_BUILD_TYPE "Debug")
8 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
9
10 MESSAGE("")
11 MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
12 MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
13
14
15 SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
16 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
17
18 ##########################################################
19 # Define Email API   
20 ##########################################################
21
22 SET(API-LIB "email-api")
23 SET(API-SRCS 
24         ${CMAKE_SOURCE_DIR}/email-api/email-api-account.c
25         ${CMAKE_SOURCE_DIR}/email-api/email-api-mail.c
26         ${CMAKE_SOURCE_DIR}/email-api/email-api-network.c
27         ${CMAKE_SOURCE_DIR}/email-api/email-api-rule.c
28         ${CMAKE_SOURCE_DIR}/email-api/email-api-mailbox.c
29         ${CMAKE_SOURCE_DIR}/email-api/email-api-init.c
30         ${CMAKE_SOURCE_DIR}/email-api/email-api-smime.c
31         ${CMAKE_SOURCE_DIR}/email-api/email-api-etc.c
32 )
33
34 INCLUDE_DIRECTORIES(
35         ${CMAKE_SOURCE_DIR}/email-daemon/include
36         ${CMAKE_SOURCE_DIR}/email-api/include
37         ${CMAKE_SOURCE_DIR}/email-api/socket/include
38         ${CMAKE_SOURCE_DIR}/email-ipc/include
39         ${CMAKE_SOURCE_DIR}/email-core/include
40         ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
41         ${CMAKE_SOURCE_DIR}/email-common-use/include
42 )
43
44 INCLUDE(FindPkgConfig)
45 pkg_check_modules(api_pkgs REQUIRED glib-2.0 dlog dbus-1 vconf heynoti db-util contacts-service uw-imap-toolkit) 
46
47 FOREACH(flag ${api_pkgs_CFLAGS})
48         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
49 ENDFOREACH(flag)
50
51 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
52
53 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
54
55 ADD_LIBRARY(${API-LIB} SHARED ${API-SRCS})
56
57 TARGET_LINK_LIBRARIES(${API-LIB} ${api_pkgs_LDFLAGS} email-ipc email-storage email-core email-common-use email-network)
58 #${NETWORK-LIB} ${CORE-LIB} ${STORAGE-LIB} ${IPC-LIB} ${COMMON-LIB})
59
60 SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
61 SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES VERSION ${VERSION})
62
63 #INSTALL(TARGETS ${API-LIB} LIBRARY DESTINATION lib)
64 INSTALL(TARGETS ${API-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
65
66 SET(EMAIL-API-HEADERS
67         ${CMAKE_SOURCE_DIR}/email-api/include/email-api.h
68         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-account.h
69         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-init.h
70         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-mail.h
71         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-mailbox.h
72         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-network.h
73         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-rule.h
74         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-etc.h
75         ${CMAKE_SOURCE_DIR}/email-api/include/email-api-smime.h
76         ${CMAKE_SOURCE_DIR}/email-common-use/include/email-types.h
77         ${CMAKE_SOURCE_DIR}/email-common-use/include/email-errors.h
78 )
79
80 INSTALL(FILES ${EMAIL-API-HEADERS} DESTINATION include/email-service)
81