1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
6 SET(VERSION "${VERSION_MAJOR}.4.2")
8 #Add your submodule directory name
9 ADD_SUBDIRECTORY(plugin/app2sd)
12 INCLUDE(FindPkgConfig)
13 pkg_check_modules(pkgs REQUIRED dlog)
15 FOREACH(flag ${pkgs_CFLAGS})
16 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
19 pkg_check_modules(libpkgs REQUIRED dlog)
21 FOREACH(flag ${libpkgs_CFLAGS})
22 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
25 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
27 ### Local include directories
28 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc ${CMAKE_SOURCE_DIR}/src)
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} ")
39 ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
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})
47 SET(CMAKE_INSTALL_PREFIX "/usr")
48 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
50 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.manifest.in ${CMAKE_BINARY_DIR}/app2sd.manifest @ONLY)
52 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY)
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)
58 ADD_SUBDIRECTORY(test)