Merge "Move internal header to src directory" into tizen
[platform/core/api/app-manager.git] / CMakeLists.txt
1
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(fw_name "capi-appfw-app-manager")
4
5 PROJECT(${fw_name})
6
7 SET(CMAKE_INSTALL_PREFIX /usr)
8 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
9
10 SET(INC_DIR include)
11 INCLUDE_DIRECTORIES(${INC_DIR})
12
13 SET(requires "capi-base-common dlog vconf aul pkgmgr pkgmgr-info glib-2.0")
14 SET(pc_requires "capi-base-common")
15
16 INCLUDE(FindPkgConfig)
17 pkg_check_modules(${fw_name} REQUIRED ${requires})
18 FOREACH(flag ${${fw_name}_CFLAGS})
19     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
20 ENDFOREACH(flag)
21
22 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
23 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
24
25 IF("${ARCH}" STREQUAL "arm")
26     ADD_DEFINITIONS("-DTARGET")
27 ENDIF("${ARCH}" STREQUAL "arm")
28
29 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
30 ADD_DEFINITIONS("-DSLP_DEBUG")
31
32 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
33
34 aux_source_directory(src SOURCES)
35 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
36
37 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
38
39 SET_TARGET_PROPERTIES(${fw_name}
40      PROPERTIES
41      VERSION ${FULLVER}
42      SOVERSION ${MAJORVER}
43      CLEAN_DIRECT_OUTPUT 1
44 )
45
46 INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
47 INSTALL(DIRECTORY ${INC_DIR}/ DESTINATION include/appfw)
48
49 SET(PC_NAME ${fw_name})
50 SET(PC_REQUIRED ${pc_requires})
51 SET(PC_LDFLAGS -l${fw_name})
52 SET(PC_CFLAGS -I\${includedir}/appfw)
53
54 CONFIGURE_FILE(
55     capi-appfw-app-manager.pc.in
56     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
57     @ONLY
58 )
59 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
60
61 IF(UNIX)
62
63 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
64 ADD_CUSTOM_COMMAND(
65         DEPENDS clean 
66         COMMENT "distribution clean"
67         COMMAND find
68         ARGS    . 
69         -not -name config.cmake -and \(
70         -name tester.c -or
71         -name Testing -or
72         -name CMakeFiles -or
73         -name cmake.depends -or
74         -name cmake.check_depends -or
75         -name CMakeCache.txt -or
76         -name cmake.check_cache -or
77         -name *.cmake -or
78         -name Makefile -or
79         -name core -or
80         -name core.* -or
81         -name gmon.out -or
82         -name install_manifest.txt -or
83         -name *.pc -or
84         -name *~ \)
85         | grep -v TC | xargs rm -rf
86         TARGET  distclean
87         VERBATIM
88 )
89
90 ENDIF(UNIX)
91
92 add_subdirectory(tool)