Tizen 2.1 base
[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 ### Required packages
11 INCLUDE(FindPkgConfig)
12 pkg_check_modules(pkgs REQUIRED dlog)
13
14 FOREACH(flag ${pkgs_CFLAGS})
15         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
16 ENDFOREACH(flag)
17
18 pkg_check_modules(libpkgs REQUIRED dlog)
19
20 FOREACH(flag ${libpkgs_CFLAGS})
21         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
22 ENDFOREACH(flag)
23
24 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
25
26 ### Local include directories
27 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc ${CMAKE_SOURCE_DIR}/src)
28
29 ## build app2ext library
30 SET(app2ext_dir "${CMAKE_SOURCE_DIR}")
31 SET(app2ext_inc_dir "${app2ext_dir}/inc")
32 SET(app2ext_src_dir "${app2ext_dir}/src")
33 SET(APP2EXT "app2ext")
34 SET(libapp2ext_SOURCES ${app2ext_src_dir}/app2ext_interface.c)
35 SET(libapp2ext_LDFLAGS " -L/usr/lib -module -avoid-version -ldl ")
36 SET(libapp2ext_CFLAGS  " ${CFLAGS} -fPIC -I${app2ext_inc_dir} ")
37
38 ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
39 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
40 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
41 SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS "${libapp2ext_CFLAGS}")
42 TARGET_LINK_LIBRARIES(${APP2EXT} ${libpkgs_LDFLAGS})
43
44 SET(CMAKE_INSTALL_PREFIX "/usr")
45 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
46
47
48 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY)
49
50 INSTALL(TARGETS ${APP2EXT} DESTINATION lib COMPONENT RuntimeLibraries)
51 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION lib/pkgconfig)
52 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
53