-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
30 lines (25 loc) · 988 Bytes
/
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
cmake_minimum_required(VERSION 3.1)
project(p2p_network)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lgmp")
set(CMAKE_CXX_STANDARD 14)
set(PROJECT_VERSION 1.0)
set(DEFAULT_BUILD_TYPE "Release")
FILE(GLOB SOURCE_FILES "src/*.cpp")
if(NOT TARGET nlohmann_json)
add_subdirectory(lib/json)
link_directories(lib/json)
MESSAGE(STATUS "Connected: nlohmann_json")
endif()
include(GNUInstallDirs)
add_library(${PROJECT_NAME} ${SOURCE_FILES} include/network.h)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1)
install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json)