Fix install libdir and version in pc file
[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(_VERSION_ "0.0.1")
23
24 ## pkgconfig ###################################################################
25 INCLUDE(FindPkgConfig)
26
27 ## default CMAKE_INSTALL_* variables ###########################################
28 INCLUDE(GNUInstallDirs)
29
30 ## Compiler flags, depending on the build type #################################
31 IF(NOT CMAKE_BUILD_TYPE)
32     SET(CMAKE_BUILD_TYPE "DEBUG")
33 ENDIF(NOT CMAKE_BUILD_TYPE)
34 MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
35
36 # special case for a GCC < 4.7, assume rest is fine
37 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
38     SET(CXX_11_STD "c++0x")
39 else()
40     SET(CXX_11_STD "c++11")
41 endif()
42
43 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg")
44 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=${CXX_11_STD} -O0 -pg")
45 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
46 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=${CXX_11_STD} -O0 -ggdb")
47 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2 -DNDEBUG")
48 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=${CXX_11_STD} -O2 -DNDEBUG")
49 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
50 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=${CXX_11_STD} -O2 --coverage")
51
52 ADD_DEFINITIONS("-fPIC")   # Position Independent Code
53 ADD_DEFINITIONS("-Werror") # Make all warnings into errors
54 ADD_DEFINITIONS("-Wall")   # Generate all warnings
55 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
56 ADD_DEFINITIONS("-pedantic") # Be pedantic
57 ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
58 ADD_DEFINITIONS(-DPROGRAM_VERSION="${VERSION}")
59 ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
60
61 ## Subdirectories ##############################################################
62 SET(SRC_FOLDER ${PROJECT_SOURCE_DIR}/src)
63
64 IF(NOT DEFINED LIB_INSTALL_DIR)
65     SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
66 ENDIF(NOT DEFINED LIB_INSTALL_DIR)
67
68 IF(NOT DEFINED INCLUDE_INSTALL_DIR)
69     SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_FULL_INCLUDEDIR})
70 ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
71
72 ADD_SUBDIRECTORY(${SRC_FOLDER})