1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
7 SET(VERSION "${SO_VERSION}.0.0")
10 SET(DEBUG_OUTPUT "-DCERT_SVC_LOG") # for debug
11 #SET(DEBUG_OUTPUT "-DCERT_SVC_LOG_CONSOLE") # for debug
13 SET(TARGET_CERT_SVC_LIB "cert-svc")
14 SET(TARGET_VCORE_LIB "cert-svc-vcore")
15 SET(TARGET_SIGN_TOOL "dpkg-pki-sig")
18 SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
19 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GC_SECTIONS_FLAGS}")
20 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_SECTIONS_FLAGS}")
22 SET(CMAKE_C_FLAGS_RELEASE "-fvisibility=hidden -Wall -O2")
23 SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++0x -Wall -O2")
25 SET(CMAKE_C_FLAGS_DEBUG "-fvisibility=hidden -Wall -O0 -g")
26 SET(CMAKE_CXX_FLAGS_DEBUG "-std=c++0x -Wall -O0 -g")
28 SET(CMAKE_C_FLAGS_CCOV "-fvisibility=hidden -Wall -O2 --coverage")
29 SET(CMAKE_CXX_FLAGS_CCOV "-std=c++0x -Wall -O2 --coverage")
31 SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
32 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
33 SET(CMAKE_SKIP_RPATH "TRUE")
35 ################################################################################
37 ################################################################################
39 PKG_CHECK_MODULES(CERT_SVC_DEPS
47 ${PROJECT_SOURCE_DIR}/srcs/cert-service.c
48 ${PROJECT_SOURCE_DIR}/srcs/cert-service-util.c
49 ${PROJECT_SOURCE_DIR}/srcs/cert-service-store.c
50 ${PROJECT_SOURCE_DIR}/srcs/cert-service-process.c
53 IF(DEFINED DEBUG_OUTPUT)
54 SET_SOURCE_FILES_PROPERTIES(${CERT_SVC_SOURCES}
55 PROPERTIES COMPILE_FLAGS ${DEBUG_OUTPUT})
56 ENDIF(DEFINED DEBUG_OUTPUT)
59 ${PROJECT_SOURCE_DIR}/include
60 ${CERT_SVC_DEPS_INCLUDE_DIRS}
63 ADD_LIBRARY(${TARGET_CERT_SVC_LIB} SHARED ${CERT_SVC_SOURCES})
65 SET_TARGET_PROPERTIES(${TARGET_CERT_SVC_LIB} PROPERTIES
66 SOVERSION ${SO_VERSION}
70 TARGET_LINK_LIBRARIES(${TARGET_CERT_SVC_LIB}
72 ${CERT_SVC_DEPS_LIBRARIES}
75 ################################################################################
77 ################################################################################
80 ${PROJECT_SOURCE_DIR}/srcs/dpkg-pki-sig.c
81 ${PROJECT_SOURCE_DIR}/srcs/cert-service-process.c
82 ${PROJECT_SOURCE_DIR}/srcs/cert-service-util.c
85 ADD_EXECUTABLE(${TARGET_SIGN_TOOL} ${SIGN_TOOL_SOURCES})
87 TARGET_LINK_LIBRARIES(${TARGET_SIGN_TOOL}
88 ${TARGET_CERT_SVC_LIB}
89 ${CERT_SVC_DEPS_LIBRARIES}
92 ################################################################################
94 CONFIGURE_FILE(cert-svc.pc.in cert-svc.pc @ONLY)
95 CONFIGURE_FILE(cert-svc-vcore.pc.in cert-svc-vcore.pc @ONLY)
97 INSTALL(TARGETS ${TARGET_CERT_SVC_LIB} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
98 INSTALL(PROGRAMS ${TARGET_SIGN_TOOL} DESTINATION ${BINDIR})
100 ${CMAKE_CURRENT_BINARY_DIR}/cert-svc.pc
101 ${CMAKE_CURRENT_BINARY_DIR}/cert-svc-vcore.pc
102 DESTINATION ${LIBDIR}/pkgconfig
104 INSTALL(FILES ${PROJECT_SOURCE_DIR}/targetinfo DESTINATION /opt/share/cert-svc/)
105 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/cert-service.h DESTINATION ${INCLUDEDIR})
107 # Now we must create empty directory for certificates.
108 # Without this directories rpm package will fail during build.
109 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
110 DESTINATION /usr/share/cert-svc/ca-certs/code-signing/native
111 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
113 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
114 DESTINATION /usr/share/cert-svc/ca-certs/code-signing/wac
115 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
117 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
118 DESTINATION /opt/share/cert-svc/certs/code-signing/wac
119 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
121 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
122 DESTINATION /opt/share/cert-svc/certs/code-signing/tizen
123 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
125 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
126 DESTINATION /opt/share/cert-svc/certs/sim/operator
127 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
129 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
130 DESTINATION /opt/share/cert-svc/certs/sim/thirdparty
131 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
133 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
134 DESTINATION /opt/share/cert-svc/certs/user
135 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
137 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
138 DESTINATION /opt/share/cert-svc/certs/trusteduser
139 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
141 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
142 DESTINATION /opt/share/cert-svc/certs/mdm/security
143 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
145 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
146 DESTINATION /opt/share/cert-svc/certs/mdm/security/cert
147 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
149 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/etc/empty
150 DESTINATION /opt/share/cert-svc/pkcs12
151 FILES_MATCHING PATTERN THISPATTERNMUSTNOTMATCH
154 ADD_SUBDIRECTORY(vcore)
155 ADD_SUBDIRECTORY(etc)