add server/client functions
[platform/core/appfw/app2sd.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
3 PROJECT(app2ext C)
4
5 SET(VERSION_MAJOR 0)
6 SET(VERSION "${VERSION_MAJOR}.4.2")
7
8 #Add your submodule directory name
9 ADD_SUBDIRECTORY(plugin/app2sd)
10
11 ### Required packages
12 INCLUDE(FindPkgConfig)
13 pkg_check_modules(pkgs REQUIRED dlog)
14
15 FOREACH(flag ${pkgs_CFLAGS})
16         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
17 ENDFOREACH(flag)
18
19 pkg_check_modules(libpkgs REQUIRED dlog)
20
21 FOREACH(flag ${libpkgs_CFLAGS})
22         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
23 ENDFOREACH(flag)
24
25 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
26
27 ### Local include directories
28 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc ${CMAKE_SOURCE_DIR}/src)
29
30 ## build app2ext library
31 SET(app2ext_dir "${CMAKE_SOURCE_DIR}")
32 SET(app2ext_inc_dir "${app2ext_dir}/inc")
33 SET(app2ext_src_dir "${app2ext_dir}/src")
34 SET(APP2EXT "app2ext")
35 SET(libapp2ext_SOURCES ${app2ext_src_dir}/app2ext_interface.c)
36 SET(libapp2ext_LDFLAGS " -L${LIB_INSTALL_DIR} -module -avoid-version -ldl ")
37 SET(libapp2ext_CFLAGS  " ${CFLAGS} -fPIC -I${app2ext_inc_dir} ")
38
39 ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
40
41 ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
42 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
43 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
44 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS "${libapp2ext_CFLAGS}")
45 TARGET_LINK_LIBRARIES(${APP2EXT} ${libpkgs_LDFLAGS})
46
47 SET(CMAKE_INSTALL_PREFIX "/usr")
48 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
49
50 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.manifest.in ${CMAKE_BINARY_DIR}/app2sd.manifest @ONLY)
51
52 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY)
53
54 INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
55 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
56 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
57
58 ADD_SUBDIRECTORY(test)
59