Add info about yaca tests. Remove unnecessary test dir.
[platform/core/security/yaca.git] / CMakeLists.txt
1 #
2 #  Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3 #
4 #  Contact: Krzysztof Jackiewicz <k.jackiewicz@samsung.com>
5 #
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License
17 #
18 #
19 # @file CMakeLists.txt
20 # @author Dariusz Michaluk (d.michaluk@samsung.com)
21 #
22
23 CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
24
25 PROJECT(yaca)
26 SET(VERSION "0.0.1")
27
28 ## pkgconfig ###################################################################
29 INCLUDE(FindPkgConfig)
30
31 ## default CMAKE_INSTALL_* variables ###########################################
32 INCLUDE(GNUInstallDirs)
33
34 ## Color output if it's possible:
35 IF (( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9))
36         OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ))
37
38         IF (YACA_BUILD_FORCE_COMPILER_COLORS)
39                 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
40         ENDIF()
41 ENDIF()
42
43 ## Compiler flags, depending on the build type #################################
44 IF(NOT CMAKE_BUILD_TYPE)
45         SET(CMAKE_BUILD_TYPE "DEBUG")
46 ENDIF(NOT CMAKE_BUILD_TYPE)
47
48 ## Print build information #####################################################
49 MESSAGE(STATUS "-------------------------------------------------")
50 MESSAGE(STATUS "Compiler:          " ${CMAKE_C_COMPILER_ID})
51 MESSAGE(STATUS "Compiler version:  " ${CMAKE_C_COMPILER_VERSION})
52 MESSAGE(STATUS "Build type:        " ${CMAKE_BUILD_TYPE})
53 MESSAGE(STATUS "-------------------------------------------------")
54
55 SET(CMAKE_C_FLAGS_DEBUG        "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
56 SET(CMAKE_C_FLAGS_RELEASE      "-std=c11 -O2 -DNDEBUG")
57
58 ADD_DEFINITIONS("-fPIC")   # Position Independent Code
59 ADD_DEFINITIONS("-Werror") # Make all warnings into errors
60 ADD_DEFINITIONS("-Wall")   # Generate all warnings
61 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
62 # TODO Remove 'no-unused-parameter' after API implementation
63 ADD_DEFINITIONS("-Wno-unused-parameter") # Supress unused parameter warning
64 ADD_DEFINITIONS("-pedantic") # Be pedantic
65 ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
66 ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
67
68 IF("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
69         # Warn about documentation problems
70         ADD_DEFINITIONS("-Wdocumentation")
71         # Enable all diagnostics
72         #ADD_DEFINITIONS("-Weverything")
73 ENDIF()
74
75 ## Subdirectories ##############################################################
76 SET(API_FOLDER ${PROJECT_SOURCE_DIR}/api)
77 SET(EXAMPLES_FOLDER ${PROJECT_SOURCE_DIR}/examples)
78 SET(SRC_FOLDER ${PROJECT_SOURCE_DIR}/src)
79
80 IF(NOT DEFINED LIB_INSTALL_DIR)
81         SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
82 ENDIF(NOT DEFINED LIB_INSTALL_DIR)
83
84 IF(NOT DEFINED INCLUDE_INSTALL_DIR)
85         SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
86 ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
87
88 IF(NOT DEFINED BIN_INSTALL_DIR)
89         SET(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
90 ENDIF(NOT DEFINED BIN_INSTALL_DIR)
91
92 IF(NOT DEFINED SHARE_INSTALL_PREFIX)
93         SET(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
94 ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
95
96 IF(NOT DEFINED EXAMPLES_DIR)
97         SET(EXAMPLES_DIR "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}/examples")
98 ENDIF(NOT DEFINED EXAMPLES_DIR)
99
100 ADD_SUBDIRECTORY(${SRC_FOLDER})
101 ADD_SUBDIRECTORY(${EXAMPLES_FOLDER})