enable dmcrypt feature
[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_DEFINITIONS("-DTIZEN_FEATURE_APP2SD_DMCRYPT_ENCRYPTION")
9
10 #Add your submodule directory name
11 ADD_SUBDIRECTORY(plugin/app2sd)
12
13 ### Required packages
14 INCLUDE(FindPkgConfig)
15 pkg_check_modules(pkgs REQUIRED dlog)
16
17 FOREACH(flag ${pkgs_CFLAGS})
18         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
19 ENDFOREACH(flag)
20
21 pkg_check_modules(libpkgs REQUIRED dlog)
22
23 FOREACH(flag ${libpkgs_CFLAGS})
24         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
25 ENDFOREACH(flag)
26
27 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
28
29 ### Local include directories
30 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
31         ${CMAKE_SOURCE_DIR}/common/inc)
32
33 ## build app2ext library
34 SET(app2ext_dir "${CMAKE_SOURCE_DIR}")
35 SET(app2ext_src_dir "${app2ext_dir}/src")
36 SET(APP2EXT "app2ext")
37 SET(libapp2ext_SOURCES
38         ${app2ext_src_dir}/app2ext_interface.c
39         ${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
40 SET(libapp2ext_LDFLAGS " -L${LIB_INSTALL_DIR} -module -avoid-version -ldl ")
41 SET(libapp2ext_CFLAGS  " ${CFLAGS} -fPIC ")
42
43 ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
44
45 ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
46 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
47 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
48 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS "${libapp2ext_CFLAGS}")
49 TARGET_LINK_LIBRARIES(${APP2EXT} ${libpkgs_LDFLAGS})
50
51 SET(CMAKE_INSTALL_PREFIX "/usr")
52 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
53
54 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.manifest.in ${CMAKE_BINARY_DIR}/app2sd.manifest @ONLY)
55
56 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY)
57
58 INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
59 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
60 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
61
62 ADD_SUBDIRECTORY(test)