Make binary install dir configurable
[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(owl)
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 (OWL_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=c99 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
56 SET(CMAKE_C_FLAGS_RELEASE      "-std=c99 -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     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdocumentation")
69     # Enable all diagnostics
70     #SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Weverything")
71 ENDIF()
72
73 ## Subdirectories ##############################################################
74 SET(API_FOLDER ${PROJECT_SOURCE_DIR}/api)
75 SET(EXAMPLES_FOLDER ${PROJECT_SOURCE_DIR}/examples)
76 SET(SRC_FOLDER ${PROJECT_SOURCE_DIR}/src)
77 SET(TEST_FOLDER ${PROJECT_SOURCE_DIR}/test)
78
79 IF(NOT DEFINED LIB_INSTALL_DIR)
80     SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
81 ENDIF(NOT DEFINED LIB_INSTALL_DIR)
82
83 IF(NOT DEFINED INCLUDE_INSTALL_DIR)
84     SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
85 ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
86
87 IF(NOT DEFINED BIN_INSTALL_DIR)
88     SET(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
89 ENDIF(NOT DEFINED BIN_INSTALL_DIR)
90
91 ADD_SUBDIRECTORY(${SRC_FOLDER})
92 #ADD_SUBDIRECTORY(${TEST_FOLDER})
93 ADD_SUBDIRECTORY(${EXAMPLES_FOLDER})