clean %post and use SYSCONFDIR
[platform/core/appfw/pkgmgr-info.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
3
4 PROJECT(pkgmgr-info C)
5
6 SET(VERSION 0.0.17)
7 SET(VERSION_MAJOR 0)
8 INCLUDE(TizenCommon)
9
10 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
11 SET(EXEC_PREFIX "\${prefix}")
12 SET(INCLUDEDIR "\${prefix}/include")
13
14 set(CMAKE_SKIP_BUILD_RPATH true)
15
16 ### Local include directories
17 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/parser)
18
19 ### Required packages
20 INCLUDE(FindPkgConfig)
21 pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0)
22
23 FOREACH(flag ${pkgs_CFLAGS})
24         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
25 ENDFOREACH(flag)
26
27
28 pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0)
29
30 FOREACH(flag ${libpkgs_CFLAGS})
31         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
32 ENDFOREACH(flag)
33
34
35 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
36
37 ## About debug
38 SET(debug_type "-DPM_CONSOLE_USE")              # for debug - use console window
39
40 ## Additional flag
41 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
42 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
43 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
44
45 ################## ## build comm libraries
46 add_subdirectory(parser)
47
48 ## build pkgmgr-info library
49 add_library(pkgmgr-info SHARED src/pkgmgr-info.c src/pkgmgr-info-internal.c)
50
51
52 SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES SOVERSION ${VERSION_MAJOR})
53 SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES VERSION ${VERSION})
54 TARGET_LINK_LIBRARIES(pkgmgr-info pkgmgr_parser ${libpkgs_LDFLAGS})
55
56 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pkgmgr-info.pc.in ${CMAKE_BINARY_DIR}/pkgmgr-info.pc @ONLY)
57 configure_file(parser_path.conf.in parser_path.conf @ONLY)
58 configure_file(pkgmgr-info.manifest.in pkgmgr-info.manifest @ONLY)
59 configure_file(pkgmgr-parser.manifest.in pkgmgr-parser.manifest @ONLY)
60 INSTALL(TARGETS pkgmgr-info DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
61 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-info.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
62 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgr-info.h DESTINATION include)
63 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${SYSCONFDIR}/package-manager/)