Move cynara-tests packaging to a separate directory
[platform/core/security/cynara.git] / test / CMakeLists.txt
1 # Copyright (c) 2014 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      Aleksander Zdyb <a.zdyb@partner.samsung.com>
17 # @brief       Cmake for tests
18 #
19
20 ############################# Check minimum CMake version #####################
21
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
23 PROJECT("cynara-tests")
24
25 ############################# cmake packages ##################################
26
27 INCLUDE(FindPkgConfig)
28
29 ############################# compiler flags ##################################
30
31 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
32 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
33 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
34 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
35
36 # Set compiler warning flags
37 ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
38 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
39 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
40
41 MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
42
43 SET(TARGET_CYNARA_TESTS "cynara-tests")
44
45 PKG_CHECK_MODULES(PKGS REQUIRED gmock_main)
46
47 SET(CYNARA_SRC ${PROJECT_SOURCE_DIR}/../src)
48
49 SET(CYNARA_SOURCES_FOR_TESTS
50     ${CYNARA_SRC}/service/storage/Storage.cpp
51     ${CYNARA_SRC}/common/types/PolicyBucket.cpp
52     ${CYNARA_SRC}/service/storage/InMemoryStorageBackend.cpp
53     ${CYNARA_SRC}/service/storage/BucketDeserializer.cpp
54     ${CYNARA_SRC}/service/storage/StorageDeserializer.cpp
55     ${CYNARA_SRC}/service/storage/StorageSerializer.cpp
56     ${CYNARA_SRC}/common/types/PolicyKey.cpp
57     ${CYNARA_SRC}/common/types/PolicyType.cpp
58 )
59
60 SET(CYNARA_TESTS_SOURCES
61     common/exceptions/bucketrecordcorrupted.cpp
62     types/policykey.cpp
63     storage/storage/policies.cpp
64     storage/storage/check.cpp
65     storage/storage/buckets.cpp
66     storage/inmemorystoragebackend/inmemorystoragebackend.cpp
67     storage/inmemorystoragebackend/search.cpp
68     storage/inmemorystoragebackend/buckets.cpp
69     storage/serializer/bucket_load.cpp
70     storage/serializer/deserialize.cpp
71     storage/serializer/dump.cpp
72     common/types/policybucket.cpp
73     helpers.cpp
74 )
75
76 INCLUDE_DIRECTORIES(
77     ${PKGS_INCLUDE_DIRS}
78     ${CYNARA_SRC}/common
79     ${CYNARA_SRC}/include
80     ${CYNARA_SRC}/service
81 )
82
83 ADD_EXECUTABLE(${TARGET_CYNARA_TESTS}
84     ${CYNARA_SOURCES_FOR_TESTS}
85     ${CYNARA_TESTS_SOURCES}
86 )
87
88 TARGET_LINK_LIBRARIES(${TARGET_CYNARA_TESTS}
89     ${PKGS_LDFLAGS} ${PKGS_LIBRARIES}
90 )
91 INSTALL(TARGETS ${TARGET_CYNARA_TESTS} DESTINATION bin)