-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
82 lines (64 loc) · 2.34 KB
/
CMakeLists.txt
File metadata and controls
82 lines (64 loc) · 2.34 KB
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
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(PROJECT_NAME network)
project(${PROJECT_NAME})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(
-g
-O0
-Wall
-fPIE
-march=native
)
else()
add_compile_options(
-O3
-march=native
-Wall
-fPIE
-g
)
endif()
# uncomment if you wish to build kqueue by default (requires) the following:
# sudo apt-get install libkqeuue-dev
# sudo apt-get install libevent-dev
# add_compile_definitions(USE_KQUEUE)
message("Build Type = ${CMAKE_BUILD_TYPE}")
###############################################################################
# Fetch the main bcpp scripts which allows us to fetch other dependencies more easily
###############################################################################
include(FetchContent)
if ("${_scripts_src_path}" STREQUAL "")
set(_scripts_src_path ${CMAKE_BINARY_DIR}/scripts-src CACHE STRING "")
message("Fetching Content: scripts.git")
FetchContent_Declare(
scripts
GIT_REPOSITORY https://github.com/buildingcpp/scripts.git
GIT_TAG main
SOURCE_DIR "${CMAKE_BINARY_DIR}/scripts-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/scripts-build"
INSTALL_DIR "${CMAKE_BINARY_DIR}"
INSTALL_COMMAND ""
)
FetchContent_MakeAvailable(scripts)
FetchContent_GetProperties(scripts)
endif()
include("${_scripts_src_path}/cmake/fetch_dependencies.cmake")
fetch_dependency("https://github.com/buildingcpp/include.git;main")
fetch_dependency("https://github.com/buildingcpp/system.git;main")
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(WORK_CONTRACT_BUILD_BENCHMARK OFF)
fetch_dependency("https://github.com/buildingcpp/work_contract.git;main")
option(NETWORK_BUILD_DEMO "Build examples" ON)
option(NETWORK_BUILD_TEST "Build tests" ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME})
set(_${PROJECT_NAME}_dir ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "")
add_subdirectory(src)