forked from victor-tucci/faucet-testnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (62 loc) · 2.28 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
cmake_minimum_required(VERSION 3.10)
message(STATUS "Cmake version ${CMAKE_VERSION}")
project(testnetFaucet)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
set(conf_depends "CONFIGURE_DEPENDS")
else()
set(conf_depends "")
endif()
if(NOT BUILD_STATIC_DEPS)
find_package(CURL REQUIRED COMPONENTS HTTP HTTPS SSL)
# CURL::libcurl wasn't added to FindCURL until cmake 3.12, so add it if necessary
if(CMAKE_VERSION VERSION_LESS 3.12 AND NOT TARGET CURL::libcurl)
add_library(libcurl UNKNOWN IMPORTED GLOBAL)
set_target_properties(libcurl PROPERTIES
IMPORTED_LOCATION ${CURL_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
add_library(CURL_libcurl INTERFACE)
target_link_libraries(CURL_libcurl INTERFACE libcurl)
add_library(CURL::libcurl ALIAS CURL_libcurl)
endif()
endif()
# for LMDB
# Check whether we're on a 32-bit or 64-bit system
if(CMAKE_SIZEOF_VOID_P EQUAL "8")
set(DEFAULT_BUILD_64 ON)
else()
set(DEFAULT_BUILD_64 OFF)
endif()
option(BUILD_64 "Build for 64-bit? 'OFF' builds for 32-bit." ${DEFAULT_BUILD_64})
if(BUILD_64)
set(ARCH_WIDTH "64")
else()
set(ARCH_WIDTH "32")
endif()
message(STATUS "Building for a ${ARCH_WIDTH}-bit system")
file(GLOB cpr_sources ${conf_depends} cpr/cpr/*.cpp)
add_library(cpr STATIC EXCLUDE_FROM_ALL ${cpr_sources})
target_link_libraries(cpr PUBLIC CURL::libcurl)
target_include_directories(cpr PUBLIC cpr/include)
target_compile_definitions(cpr PUBLIC CPR_CURL_NOSIGNAL)
add_library(cpr::cpr ALIAS cpr)
# for LMDB
find_package(Threads)
add_subdirectory(db_drivers)
add_subdirectory(db)
add_subdirectory(nlhomann)
add_subdirectory(served)
add_executable(testnetfaucet testnetfaucet.cpp)
add_executable(data_table datacursor.cpp)
add_executable(history_table historycursor.cpp)
target_include_directories(data_table PUBLIC db)
target_include_directories(history_table PUBLIC db)
target_link_libraries(data_table PUBLIC database)
target_link_libraries(history_table PUBLIC database)
target_include_directories(testnetfaucet PUBLIC db nlhomann/include served/src)
target_link_libraries(testnetfaucet PUBLIC database cpr::cpr nlohmann_json served)