Support for reading and writing 0 bytes to fdstore
[archive/platform/core/system/libConfig.git] / 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 #
16 # @file   CMakeLists.txt
17 # @author Jacek Pielaszkiewicz (j.pielaszkie@samsung.com)
18 #
19 CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
20 PROJECT(Config)
21
22 SET(_LIB_VERSION_ "0.0.1")
23 SET(_LIB_SOVERSION_ "0")
24
25 ## pkgconfig ###################################################################
26 INCLUDE(FindPkgConfig)
27
28 ## default CMAKE_INSTALL_* variables ###########################################
29 INCLUDE(GNUInstallDirs)
30
31 ## Compiler flags, depending on the build type #################################
32 IF(NOT CMAKE_BUILD_TYPE)
33     SET(CMAKE_BUILD_TYPE "DEBUG")
34 ENDIF(NOT CMAKE_BUILD_TYPE)
35 MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
36
37 # special case for a GCC < 4.7, assume rest is fine
38 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
39     SET(CXX_11_STD "c++0x")
40 else()
41     SET(CXX_11_STD "c++11")
42 endif()
43
44 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg")
45 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=${CXX_11_STD} -O0 -pg")
46 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
47 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=${CXX_11_STD} -O0 -ggdb")
48 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2 -DNDEBUG")
49 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=${CXX_11_STD} -O2 -DNDEBUG")
50 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
51 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=${CXX_11_STD} -O2 --coverage")
52
53 ADD_DEFINITIONS("-fPIC")   # Position Independent Code
54 ADD_DEFINITIONS("-Werror") # Make all warnings into errors
55 ADD_DEFINITIONS("-Wall")   # Generate all warnings
56 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
57 ADD_DEFINITIONS("-pedantic") # Be pedantic
58 ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
59 ADD_DEFINITIONS(-DPROGRAM_VERSION="${VERSION}")
60 ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
61
62 ## Subdirectories ##############################################################
63 SET(SRC_FOLDER ${PROJECT_SOURCE_DIR}/src)
64
65 IF(NOT DEFINED LIB_INSTALL_DIR)
66     SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
67 ENDIF(NOT DEFINED LIB_INSTALL_DIR)
68
69 IF(NOT DEFINED INCLUDE_INSTALL_DIR)
70     SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
71 ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
72
73 ADD_SUBDIRECTORY(${SRC_FOLDER})