forked from meltwater/served
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
127 lines (112 loc) · 4.23 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Copyright (C) 2014 MediaSift Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Project Properties
#
CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
PROJECT (served)
SET (APPLICATION_NAME "Served HTTP REST Library")
SET (APPLICATION_CODENAME "${PROJECT_NAME}")
SET (APPLICATION_COPYRIGHT_YEARS "2014")
SET (APPLICATION_VERSION_MAJOR 1)
SET (APPLICATION_VERSION_MINOR 3)
SET (APPLICATION_VERSION_PATCH 1)
SET (APPLICATION_VERSION_TYPE DS1)
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}")
SET (APPLICATION_VENDOR_ID "com.datasift")
SET (APPLICATION_VENDOR_NAME "DataSift")
SET (APPLICATION_VENDOR_URL "datasift.com")
SET (APPLICATION_ID "${APPLICATION_VENDOR_ID}.${PROJECT_NAME}")
#
# Configurable Options
#
OPTION (SERVED_BUILD_SHARED "Build shared object" ON)
OPTION (SERVED_BUILD_STATIC "Build static library" OFF)
OPTION (SERVED_BUILD_TESTS "Build unit test suite" ON)
OPTION (SERVED_BUILD_EXAMPLES "Build examples" ON)
OPTION (SERVED_BUILD_RPM "Build RPM package" OFF)
OPTION (SERVED_BUILD_DEB "Build DEB package" OFF)
#
# Debugging Options
#
SET (CMAKE_VERBOSE_MAKEFILE 0) # Use 1 for debugging, 0 for release
#
# Project Output Paths
#
SET (MAINFOLDER ${PROJECT_SOURCE_DIR})
SET (EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin")
SET (LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib")
#
# Project Search Paths
#
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}")
SET (CMAKE_MODULE_PATH "${MAINFOLDER}/cmake")
INCLUDE_DIRECTORIES ("${MAINFOLDER}/src")
#
# Locate Project Prerequisites
#
FIND_PACKAGE (Boost 1.53 COMPONENTS "system" REQUIRED)
INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES (${Boost_LIBRARY_DIRS})
INCLUDE (FindRAGEL)
FIND_PACKAGE (RAGEL)
INCLUDE (FindRE2)
FIND_PACKAGE (RE2 REQUIRED)
INCLUDE_DIRECTORIES (${RE2_INCLUDE_DIR})
FIND_PACKAGE (Threads)
INCLUDE (EnableStdCXX11)
ENABLE_STDCXX11 ()
#
# Configure Files
#
FILE (GLOB_RECURSE CONFIGINPUTS1 src/served/*.hpp.in.cmake)
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS1}")
FOREACH (CONFIGINPUT ${CONFIGINPUTS})
STRING (REPLACE ".hpp.in.cmake" ".hpp" CONFIGOUTPUT "${CONFIGINPUT}")
CONFIGURE_FILE ("${CONFIGINPUT}" "${CONFIGOUTPUT}")
ENDFOREACH (CONFIGINPUT ${CONFIGINPUTS})
#
# Add Build Targets
#
IF (SERVED_BUILD_TESTS)
ENABLE_TESTING (true)
ENDIF (SERVED_BUILD_TESTS)
ADD_SUBDIRECTORY (src)
#
# CPack Generic
#
SET(CPACK_PACKAGE_NAME "libserved")
SET(CPACK_PACKAGE_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Served is a C++ library for building high performance RESTful web servers")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
SET(CPACK_PACKAGE_VENDOR "${APPLICATION_VENDOR_NAME}")
SET(CPACK_PACKAGE_URL "${APPLICATION_VENDOR_URL}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
SET(CPACK_SOURCE_GENERATOR "TGZ")
IF (SERVED_BUILD_DEB)
INCLUDE(CPackConfigDEB)
ENDIF (SERVED_BUILD_DEB)
IF (SERVED_BUILD_RPM)
INCLUDE(CPackConfigRPM)
ENDIF (SERVED_BUILD_RPM)
INCLUDE(CPack)