-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (68 loc) · 2.73 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
########################################################
# Top-level CMakeLists.txt to build Sauron
# @author LAGARDE Francois
cmake_minimum_required(VERSION 3.1)
########################################################
project(sauron VERSION 0.9 LANGUAGES C CXX)
set(CMAKE_INSTALL_PREFIX "")
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/bin)
else()
endif()
# set the C++ standard to C++ 17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/)
set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-fPIC ${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib/" )
macro( set_if_not )
if( NOT ${ARGV0} )
set( ${ARGN} )
endif()
endmacro()
set_if_not( jsoncpp_repository "https://github.com/RPClab/jsoncpp" )
set_if_not( jsoncpp_version "master" )
set_if_not( mariadbpp_repository "https://github.com/RPClab/mariadbpp" )
set_if_not( mariadbpp_version "master" )
include(ExternalProject)
option(CLIENT "Build the client" OFF)
option(SERVER "Build the server" OFF)
option(SAURON "Build the library" ON)
if(CLIENT)
add_subdirectory(source/Sauron/Client)
endif()
if(SERVER)
set(SAURON ON)
add_subdirectory(source/Sauron/Server)
endif()
if(SAURON)
# dependencies
find_package(MariaDBClient REQUIRED)
# find_package(OpenSSL REQUIRED)
# ----- jsoncpp package -----
ExternalProject_Add(
jsoncpp
GIT_REPOSITORY ${jsoncpp_repository}
GIT_TAG ${jsoncpp_version}
GIT_PROGRESS TRUE
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS="-fPIC"
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/jsoncpp-prefix
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/jsoncpp
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
LIST_SEPARATOR %
UPDATE_COMMAND ""
)
# ----- mariadb++ package -----
ExternalProject_Add(
mariadbpp
GIT_REPOSITORY ${mariadbpp_repository}
GIT_TAG ${mariadbpp_version}
GIT_PROGRESS TRUE
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS="-fPIC"
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mariadbpp-prefix
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/mariadbpp
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
LIST_SEPARATOR %
UPDATE_COMMAND ""
)
add_subdirectory(source/Sauron)
endif()