97f1239d74849c231b63f7fd41154792b6148085
[platform/core/test/security-tests.git] / src / ckm / CMakeLists.txt
1 # Copyright (c) 2013-2019 Samsung Electronics Co., Ltd All Rights Reserved
2 #
3 #   Licensed under the Apache License, Version 2.0 (the "License");
4 #   you may not use this file except in compliance with the License.
5 #   You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #   Unless required by applicable law or agreed to in writing, software
10 #   distributed under the License is distributed on an "AS IS" BASIS,
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #   See the License for the specific language governing permissions and
13 #   limitations under the License.
14 #
15 # @file        CMakeLists.txt
16 # @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
17 # @brief
18 #
19
20 INCLUDE(FindPkgConfig)
21
22 # mdpp flag
23 IF (DEFINED SECURITY_MDFPP_STATE_ENABLED)
24     MESSAGE("SECURITY_MDFPP_STATE_ENABLE ENABLED !")
25     ADD_DEFINITIONS("-DSECURITY_MDFPP_STATE_ENABLE")
26 ELSE (DEFINED SECURITY_MDFPP_STATE_ENABLED)
27     MESSAGE("SECURITY_MDFPP_STATE_ENABLE DISABLED !")
28 ENDIF (DEFINED SECURITY_MDFPP_STATE_ENABLED)
29
30 ADD_DEFINITIONS("-DCKM_TEST_DIR=\"${CKM_TEST_DIR}\"")
31 ADD_DEFINITIONS("-DCKM_RW_DATA_DIR=\"${CKM_RW_DATA_DIR}\"")
32 OPTION("TZ_BACKEND" OFF)
33 IF(TZ_BACKEND)
34     ADD_DEFINITIONS("-DTZ_BACKEND")
35 ENDIF(TZ_BACKEND)
36
37 OPTION("TZ_BACKEND" OFF)
38 IF(TZ_BACKEND)
39     ADD_DEFINITIONS("-DTZ_BACKEND")
40 ENDIF(TZ_BACKEND)
41
42 PKG_CHECK_MODULES(CKM_TEST_COMMON_DEP
43     REQUIRED
44     openssl1.1
45     key-manager
46     libtzplatform-config
47 )
48
49 SET(CKM_TEST_COMMON_SRCS
50     ckm-common.cpp
51     test-certs.cpp
52 )
53
54 INCLUDE_DIRECTORIES(SYSTEM ${CKM_TEST_COMMON_DEP_INCLUDE_DIRS})
55 INCLUDE_DIRECTORIES(
56     .
57     ${PROJECT_SOURCE_DIR}/src/common
58 )
59
60 ADD_LIBRARY(${TARGET_CKM_TEST_COMMON} ${CKM_TEST_COMMON_SRCS})
61
62 TARGET_LINK_LIBRARIES(${TARGET_CKM_TEST_COMMON}
63     ${CKM_TEST_COMMON_DEP_LIBRARIES}
64     ${COMMON_TARGET_TEST}
65 )
66
67 # C compilation test
68 SET(TARGET_C_COMPILATION_TEST "ckm-c-compilation-test")
69 SET(C_COMPILATION_SOURCES c-compilation.c)
70 PKG_CHECK_MODULES(CKM_C_COMPILATION_DEP REQUIRED key-manager)
71 ADD_EXECUTABLE(${TARGET_C_COMPILATION_TEST} ${C_COMPILATION_SOURCES})
72 TARGET_LINK_LIBRARIES(${TARGET_C_COMPILATION_TEST} ${CKM_C_COMPILATION_DEP_LIBRARIES})
73
74 INSTALL(DIRECTORY resource/ DESTINATION ${CKM_TEST_DIR})
75
76 ADD_SUBDIRECTORY(privileged)
77 ADD_SUBDIRECTORY(unprivileged)