bf7c6d17ebd00096804010e703ab2dc8d4a459e1
[platform/core/connectivity/smartcard-service.git] / common / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(smartcard-service-common CXX)
3
4 SET(LIB_NAME "smartcard-service-common")
5 SET(VERSION_MAJOR 1)
6 SET(VERSION ${VERSION_MAJOR}.0.0)
7
8 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
9
10 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SRCS)
11
12 #IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
13 #       SET(CMAKE_BUILD_TYPE "Debug")
14 #ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
15 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
16
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(pkgs_common REQUIRED glib-2.0 gio-unix-2.0 dlog aul libssl libcrypto pkgmgr pkgmgr-info)
19
20 MESSAGE("${LIB_NAME} ld flag : ${pkgs_common_LDFLAGS}")
21
22 FOREACH(flag ${pkgs_common_CFLAGS})
23         SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
24         SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
25 ENDFOREACH(flag)
26
27 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -finstrument-functions -fPIC")
28 #SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
29 #SET(CMAKE_C_FLAGS_RELEASE "-O2")
30
31 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -finstrument-functions -std=c++0x")
32 #SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
33 #SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
34
35 FIND_PROGRAM(UNAME NAMES uname)
36 EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
37 IF("${ARCH}" STREQUAL "arm")
38         ADD_DEFINITIONS("-DTARGET")
39         MESSAGE("add -DTARGET")
40 ENDIF("${ARCH}" STREQUAL "arm")
41
42 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
43 ADD_DEFINITIONS("-DSLP_DEBUG")
44 ADD_DEFINITIONS("-DUSE_UNIX_DOMAIN")
45 ADD_DEFINITIONS("-DLOG_TAG=\"SMARTCARD_SERVICE_COMMON\"")
46
47 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
48
49 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
50
51 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
52 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${VERSION})
53
54 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_common_LDFLAGS})
55
56 SET(EXPORT_HEADER
57         include/smartcard-types.h
58         include/Debug.h
59         include/Exception.h
60         include/ByteArray.h
61         include/Lock.h
62         include/Synchronous.h
63         include/TerminalInterface.h
64         include/Terminal.h
65         include/SignatureHelper.h
66 )
67
68 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
69 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
70 FOREACH(hfile ${EXPORT_HEADER})
71         INSTALL(FILES ${hfile} DESTINATION include/${LIB_NAME})
72 ENDFOREACH(hfile)