Tizen 5.x migration from OpenSSL 1.0.2 to OpenSSL 1.1.1
[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 openssl1.1 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 SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/smartcard-service-gdbus.c PROPERTIES GENERATED TRUE)
54
55 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_common_LDFLAGS})
56
57 SET(EXPORT_HEADER
58         include/smartcard-types.h
59         include/Debug.h
60         include/Exception.h
61         include/ByteArray.h
62         include/Lock.h
63         include/Synchronous.h
64         include/TerminalInterface.h
65         include/Terminal.h
66         include/SignatureHelper.h
67         include/SessionHelper.h
68         include/Channel.h
69         include/ReaderHelper.h
70         include/APDUHelper.h
71         include/GDBusHelper.h
72         include/ProviderHelper.h
73         include/TLVHelper.h
74         include/SEServiceHelper.h
75         include/OpensslHelper.h
76         smartcard-service-gdbus.h
77 )
78
79 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
80 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
81 FOREACH(hfile ${EXPORT_HEADER})
82         INSTALL(FILES ${hfile} DESTINATION include/${LIB_NAME})
83 ENDFOREACH(hfile)