1 # Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # @file CMakeLists.txt
16 # @author Aleksander Zdyb <a.zdyb@partner.samsung.com>
17 # @brief Cmake for tests
20 ############################# Check minimum CMake version #####################
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
23 PROJECT("cynara-tests")
25 ############################# cmake packages ##################################
27 INCLUDE(FindPkgConfig)
29 ############################# compiler flags ##################################
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")
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 ADD_DEFINITIONS("-DCYNARA_NO_LOGS") # Disable building logs
42 MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
44 SET(TARGET_CYNARA_TESTS "cynara-tests")
46 PKG_CHECK_MODULES(PKGS REQUIRED gmock_main)
48 SET(CYNARA_SRC ${PROJECT_SOURCE_DIR}/../src)
50 SET(CYNARA_SOURCES_FOR_TESTS
51 ${CYNARA_SRC}/service/storage/Storage.cpp
52 ${CYNARA_SRC}/common/types/PolicyBucket.cpp
53 ${CYNARA_SRC}/service/storage/InMemoryStorageBackend.cpp
54 ${CYNARA_SRC}/service/storage/BucketDeserializer.cpp
55 ${CYNARA_SRC}/service/storage/StorageDeserializer.cpp
56 ${CYNARA_SRC}/service/storage/StorageSerializer.cpp
57 ${CYNARA_SRC}/common/types/PolicyKey.cpp
58 ${CYNARA_SRC}/common/types/PolicyType.cpp
61 SET(CYNARA_TESTS_SOURCES
62 common/exceptions/bucketrecordcorrupted.cpp
64 storage/storage/policies.cpp
65 storage/storage/check.cpp
66 storage/storage/buckets.cpp
67 storage/inmemorystoragebackend/inmemorystoragebackend.cpp
68 storage/inmemorystoragebackend/search.cpp
69 storage/inmemorystoragebackend/buckets.cpp
70 storage/serializer/bucket_load.cpp
71 storage/serializer/deserialize.cpp
72 storage/serializer/dump.cpp
73 storage/serializer/serialize.cpp
74 common/types/policybucket.cpp
85 ADD_EXECUTABLE(${TARGET_CYNARA_TESTS}
86 ${CYNARA_SOURCES_FOR_TESTS}
87 ${CYNARA_TESTS_SOURCES}
90 TARGET_LINK_LIBRARIES(${TARGET_CYNARA_TESTS}
91 ${PKGS_LDFLAGS} ${PKGS_LIBRARIES}
93 INSTALL(TARGETS ${TARGET_CYNARA_TESTS} DESTINATION bin)