Refactor make system and directory hierarchy
[platform/upstream/csr-framework.git] / CMakeLists.txt
1 # Copyright (c) 2016 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 # @file        CMakeLists.txt
16 # @author      Kyungwook Tak (k.tak@samsung.com)
17 # @brief       csr-framework project cmake file on the top
18 #
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
20 PROJECT(${SERVICE_NAME})
21
22 INCLUDE(FindPkgConfig)
23
24 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
25 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++0x -O0 -pg -Wp,-U_FORTIFY_SOURCE")
26 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
27 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
28 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
29 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
30 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
31 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
32
33 ADD_DEFINITIONS("-fPIC")
34 ADD_DEFINITIONS("-Werror")
35 ADD_DEFINITIONS("-Wall")
36 ADD_DEFINITIONS("-Wextra")
37
38 STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
39 ADD_DEFINITIONS("-DSERVICE_NAME=\"${SERVICE_NAME}\"")
40 ADD_DEFINITIONS("-DCLIENT_NAME=\"${CLIENT_NAME}\"")
41 ADD_DEFINITIONS("-DINCLUDE_INSTALL_DIR=\"${INCLUDE_INSTALL_DIR}\"")
42
43 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
44     ADD_DEFINITIONS("-DTIZEN_DEBUG_ENABLE")
45     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
46 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
47
48 SET(TARGET_CSR_SERVER "csr")
49 #SET(TARGET_CSR_CLIENT "csr-client")
50 SET(TARGET_CSR_CLIENT ${CLIENT_NAME}) # for backward-compatibility.
51 SET(TARGET_CSR_COMMON "csr-common")
52
53 ADD_SUBDIRECTORY(src)
54 ADD_SUBDIRECTORY(pkgconfig)
55
56 IF (DEFINED CSR_FW_TEST_BUILD)
57     SET(TARGET_CSR_TEST   "csr-test")
58     ADD_SUBDIRECTORY(test)
59 ENDIF (DEFINED CSR_FW_TEST_BUILD)