4f9efb700b5832e20f68e411fdd5939e10351b98
[platform/core/api/location-manager.git] / CMakeLists.txt
1
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(fw_name "capi-location-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(dependents "dlog location capi-base-common")
14 SET(pc_dependents "capi-base-common")
15
16 INCLUDE(FindPkgConfig)
17 pkg_check_modules(${fw_name} REQUIRED ${dependents})
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} -fvisibility=hidden -fPIC -Wall -Werror")
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("-DEXPORT_API=__attribute__((visibility(\"default\")))")
31 ADD_DEFINITIONS("-DTIZEN_DEBUG")
32
33 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
34
35 aux_source_directory(src SOURCES)
36 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
37
38 SET_TARGET_PROPERTIES(${fw_name}
39      PROPERTIES
40      VERSION ${FULLVER}
41      SOVERSION ${MAJORVER}
42      CLEAN_DIRECT_OUTPUT 1
43 )
44
45 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
46
47 INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
48 INSTALL(
49         DIRECTORY ${INC_DIR}/ DESTINATION include/location
50         FILES_MATCHING
51         PATTERN "*_private.h" EXCLUDE
52         PATTERN "${INC_DIR}/*.h"
53         )
54
55 SET(PC_NAME ${fw_name})
56 SET(PC_REQUIRED ${pc_dependents})
57 SET(PC_LDFLAGS -l${fw_name})
58 SET(PC_CFLAGS -I\${includedir}/location)
59
60 CONFIGURE_FILE(
61     ${fw_name}.pc.in
62     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
63     @ONLY
64 )
65 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
66
67 ADD_SUBDIRECTORY(test)
68
69 IF(UNIX)
70
71 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
72 ADD_CUSTOM_COMMAND(
73         DEPENDS clean
74         COMMENT "distribution clean"
75         COMMAND find
76         ARGS    .
77         -not -name config.cmake -and \(
78         -name tester.c -or
79         -name Testing -or
80         -name CMakeFiles -or
81         -name cmake.depends -or
82         -name cmake.check_depends -or
83         -name CMakeCache.txt -or
84         -name cmake.check_cache -or
85         -name *.cmake -or
86         -name Makefile -or
87         -name core -or
88         -name core.* -or
89         -name gmon.out -or
90         -name install_manifest.txt -or
91         -name *.pc -or
92         -name *~ \)
93         | grep -v TC | xargs rm -rf
94         TARGET  distclean
95         VERBATIM
96 )
97
98 ENDIF(UNIX)
99