-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
88 lines (75 loc) · 2.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###############################################################################
#
# Zevenet zproxy Load Balancer Software License
# This file is part of the Zevenet zproxy Load Balancer software package.
#
# Copyright (C) 2019-today ZEVENET SL, Sevilla (Spain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
cmake_minimum_required(VERSION 3.6)
set(CMAKE_CXX_STANDARD 17)
if(EXISTS CMakeLists.txt)
message(FATAL_ERROR"Please create a cmake build directory, running cmake form source tree root is not allowed\n")
endif()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif ()
set (CMAKE_ENABLE_EXPORTS TRUE)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(MAINFOLDER ${PROJECT_SOURCE_DIR})
set(PROJECT_VERSION "0.0.1")
set(PROJECT_DESCRIPTION "Zevenet core utils library")
set(PROJECT_CODENAME "zcutils")
# get current git info
if (EXISTS "${PROJECT_SOURCE_DIR}/.git/HEAD")
file(READ "${PROJECT_SOURCE_DIR}/.git/HEAD"
PROJECT_SOURCE_VERSION)
if ("${PROJECT_SOURCE_VERSION}" MATCHES "^ref:")
string(REGEX REPLACE "^ref: *([^ \n\r]*).*" "\\1"
PROJECT_GIT_REF "${PROJECT_SOURCE_VERSION}")
file(READ "${PROJECT_SOURCE_DIR}/.git/${PROJECT_GIT_REF}"
PROJECT_SOURCE_VERSION)
endif ()
string(STRIP "${PROJECT_SOURCE_VERSION}"
PROJECT_SOURCE_VERSION)
endif ()
add_definitions(-DPROJECT_NAME="zcutils")
add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
if (UNIQUE_BUILD_DIRECTORY)
set(EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/build/bin")
endif ()
set(sources
## sources
src/zcu_log.c
src/zcu_network.c
src/zcu_backtrace.c
src/zcu_sbuffer.c
src/zcu_string.c
## libs
include/zcu_log.h
include/zcu_common.h
include/zcu_backtrace.h
include/zcu_environment.h
include/zcu_http.h
include/zcu_time.h
include/zcu_network.h
include/zcu_sbuffer.h
include/zcu_string.h
)
include_directories(${PROJECT_SOURCE_DIR}/zcutils/include)
add_library(zcutils ${sources})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -pipe -g -Wno-unused-function -Wall")
include_directories(${PROJECT_SOURCE_DIR}/include)