-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
66 lines (57 loc) · 2.09 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
cmake_minimum_required(VERSION 3.14)
project(jetproxy VERSION 2.0.7 LANGUAGES CXX)
option(JETPROXY_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF)
option(JETPROXY_EXAMPLES "Build examples of usages" OFF)
find_package(Threads)
include(FetchContent)
set(jsoncpp_REQUIREDVERSION "1.9.3")
find_package(jsoncpp ${jsoncpp_REQUIREDVERSION} QUIET)
if(jsoncpp_FOUND)
message(STATUS "Found jsoncpp: ${jsoncpp_VERSION} ${jsoncpp_CONFIG}")
else()
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF)
set(JSONCPP_WITH_TESTS OFF)
set(JSONCPP_WITH_STRICT_ISO OFF)
message(STATUS "Fetching jsoncpp ${jsoncpp_REQUIREDVERSION}...")
FetchContent_Declare(
jsoncpp
URL https://github.com/open-source-parsers/jsoncpp/archive/${jsoncpp_REQUIREDVERSION}.zip
)
FetchContent_MakeAvailable(jsoncpp)
endif()
set(hbk_REQUIREDVERSION "2.1.0")
find_package(hbk ${hbk_REQUIREDVERSION} QUIET)
if(hbk_FOUND)
message(STATUS "Found hbk: ${hbk_VERSION} ${hbk_CONFIG}")
else(hbk_FOUND)
set(hbk_POST_BUILD_UNITTEST OFF)
message(STATUS "Fetching hbk ${hbk_REQUIREDVERSION}...")
FetchContent_Declare(
hbk
URL https://github.com/hbkworld/libhbk/archive/refs/tags/v${hbk_REQUIREDVERSION}.tar.gz
)
FetchContent_MakeAvailable(hbk)
endif(hbk_FOUND)
set(jetpeer_REQUIREDVERSION "3.0.6")
find_package(jetpeerasync ${jetpeer_REQUIREDVERSION} QUIET)
find_package(jetpeer ${jetpeer_REQUIREDVERSION} QUIET)
if(jetpeer_FOUND AND jetpeerasync_FOUND)
message(STATUS "Found jetpeer: ${jetpeer_VERSION} ${jetpeer_CONFIG}")
message(STATUS "Found jetpeerasync: ${jetpeerasync_VERSION} ${jetpeerasync_CONFIG}")
else()
set(JETPEER_POST_BUILD_UNITTEST OFF)
message(STATUS "Fetching jetpeer ${jetpeer_REQUIREDVERSION}...")
FetchContent_Declare(
jetpeer
URL https://github.com/hbkworld/jetpeer-cpp/archive/refs/tags/v${jetpeer_REQUIREDVERSION}.tar.gz
)
FetchContent_MakeAvailable(jetpeer)
endif()
add_subdirectory("lib")
if(JETPROXY_EXAMPLES)
add_subdirectory("example")
endif()
if(JETPROXY_POST_BUILD_UNITTEST)
enable_testing()
add_subdirectory("test")
endif()