-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
86 lines (67 loc) · 2.43 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
# Copyright 2014-2016, Corvusoft Ltd, All Rights Reserved.
cmake_minimum_required( VERSION 2.8.10 )
project( "restq" )
set( restq_VERSION_MAJOR 1 )
set( restq_VERSION_MINOR 5.0 )
set( restq_VERSION ${restq_VERSION_MAJOR}.${restq_VERSION_MINOR} )
set( PACKAGE_VERSION ${restq_VERSION} )
set( VERSION "${restq_VERSION}" )
#
# Build Options
#
option( BUILD_SHARED "Build shared library." OFF )
option( BUILD_EXAMPLES "Build examples applications." OFF )
option( BUILD_TESTS "Build all available test suites." OFF )
option( BUILD_SSL "Build secure socket layer support." ON )
#
# Configuration
#
include( "${CMAKE_SOURCE_DIR}/cmake/configuration.cmake" )
message( " ${Blue}Copyright 2014-2016, Corvusoft Ltd, All Rights Reserved.${Reset}" )
#
# Dependencies
#
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules" )
find_package( md5 REQUIRED )
find_package( asio REQUIRED )
find_package( load REQUIRED )
find_package( restbed REQUIRED )
find_package( kashmir REQUIRED )
include_directories( SYSTEM ${md5_INCLUDE} ${asio_INCLUDE} ${load_INCLUDE} ${restbed_INCLUDE} ${kashmir_INCLUDE} )
if ( BUILD_SSL )
find_package( openssl REQUIRED )
include_directories( SYSTEM ${ssl_INCLUDE} )
endif ( )
#
# Build
#
include( "${CMAKE_SOURCE_DIR}/cmake/manifest.cmake" )
include_directories( ${INCLUDE_DIR} )
add_library( ${PROJECT_NAME} ${MANIFEST} ${load_SOURCE} $<TARGET_OBJECTS:restbed> )
if ( BUILD_SHARED )
set_target_properties( ${PROJECT_NAME} PROPERTIES SOVERSION ${restq_VERSION_MAJOR} VERSION ${restq_VERSION} )
endif ( )
if ( BUILD_SSL )
target_link_libraries( ${PROJECT_NAME} LINK_PRIVATE ${ssl_LIBRARY} ${crypto_LIBRARY} )
else ( )
target_link_libraries( ${PROJECT_NAME} )
endif ( )
if ( BUILD_EXAMPLES )
find_package( json REQUIRED )
add_subdirectory( "${CMAKE_SOURCE_DIR}/example" )
endif ( )
if ( BUILD_TESTS )
find_package( catch REQUIRED )
enable_testing( )
add_subdirectory( "${CMAKE_SOURCE_DIR}/test/unit" "unit-tests" )
add_subdirectory( "${CMAKE_SOURCE_DIR}/test/integration" "integration-tests" )
endif ( )
#
# Install
#
include( "${CMAKE_SOURCE_DIR}/cmake/artifacts.cmake" )
install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "include" )
install( FILES ${ARTIFACTS} DESTINATION "include/corvusoft/${PROJECT_NAME}" )
install( TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION "library"
ARCHIVE DESTINATION "library" COMPONENT library )