1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(smartcard-service-common CXX)
4 SET(LIB_NAME "smartcard-service-common")
6 SET(VERSION ${VERSION_MAJOR}.0.0)
8 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
10 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SRCS)
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}")
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(pkgs_common REQUIRED glib-2.0 gio-unix-2.0 dlog aul libssl libcrypto pkgmgr pkgmgr-info)
20 MESSAGE("${LIB_NAME} ld flag : ${pkgs_common_LDFLAGS}")
22 FOREACH(flag ${pkgs_common_CFLAGS})
23 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
24 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
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")
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")
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")
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\"")
47 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
49 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
51 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
52 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${VERSION})
54 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_common_LDFLAGS})
57 include/smartcard-types.h
63 include/TerminalInterface.h
65 include/SignatureHelper.h
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})