Remove no-unused-parameter compilation flag. Fix some errors.
[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 ADD_DEFINITIONS("-pedantic") # Be pedantic
63 ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
64 ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
65
66 IF("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
67         # Warn about documentation problems
68         ADD_DEFINITIONS("-Wdocumentation")
69         # Enable all diagnostics
70         #ADD_DEFINITIONS("-Weverything")
71 ENDIF()
72
73 ## Subdirectories ##############################################################
74 SET(API_FOLDER ${PROJECT_SOURCE_DIR}/api/yaca)
75 SET(EXAMPLES_FOLDER ${PROJECT_SOURCE_DIR}/examples)
76 SET(SRC_FOLDER ${PROJECT_SOURCE_DIR}/src)
77
78 IF(NOT DEFINED LIB_INSTALL_DIR)
79         SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
80 ENDIF(NOT DEFINED LIB_INSTALL_DIR)
81
82 IF(NOT DEFINED INCLUDE_INSTALL_DIR)
83         SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
84 ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
85
86 IF(NOT DEFINED BIN_INSTALL_DIR)
87         SET(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
88 ENDIF(NOT DEFINED BIN_INSTALL_DIR)
89
90 IF(NOT DEFINED SHARE_INSTALL_PREFIX)
91         SET(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
92 ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
93
94 IF(NOT DEFINED EXAMPLES_DIR)
95         SET(EXAMPLES_DIR "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}/examples")
96 ENDIF(NOT DEFINED EXAMPLES_DIR)
97
98 ADD_SUBDIRECTORY(${SRC_FOLDER})
99 ADD_SUBDIRECTORY(${EXAMPLES_FOLDER})