-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
63 lines (47 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
63 lines (47 loc) · 1.83 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
# Copyright (c) 2019-2025 by Cliff Green
#
# https://github.com/connectivecpp/chops-net-ip
#
# I'm still learning CMake, so improvement suggestions are always welcome.
#
# The Asio CMake code is taken from CPM.cmake examples/asio-standalone.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
cmake_minimum_required ( VERSION 3.14 FATAL_ERROR )
project ( chops_net_ip
LANGUAGES CXX
DESCRIPTION "An asynchronous networking library based on Asio"
HOMEPAGE_URL "https://github.com/connectivecpp/chops-net-ip/" )
option ( CHOPS_NET_IP_BUILD_TESTS "Build unit tests" OFF )
option ( CHOPS_NET_IP_BUILD_EXAMPLES "Build examples" OFF )
option ( CHOPS_NET_IP_INSTALL "Install header only library" OFF )
# add library targets
add_library ( chops_net_ip INTERFACE )
add_library ( chops::chops_net_ip ALIAS chops_net_ip )
# thread support specified in Asio download
# dependencies needed for main library
include ( cmake/download_cpm.cmake )
CPMAddPackage ( "gh:connectivecpp/shared-buffer@1.0.5" )
CPMAddPackage ( "gh:martinmoene/expected-lite@0.10.0" )
include ( cmake/download_asio_cpm.cmake )
# configure library target
target_include_directories ( chops_net_ip INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:include/> )
target_compile_features ( chops_net_ip INTERFACE cxx_std_20 )
# check to build unit tests
if ( ${CHOPS_NET_IP_BUILD_TESTS} )
enable_testing()
add_subdirectory ( test )
endif ()
# check to build example code
if ( ${CHOPS_NET_IP_BUILD_EXAMPLES} )
add_subdirectory ( example )
endif ()
# check to install
if ( ${CHOPS_NET_IP_INSTALL} )
set ( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt )
include ( CPack )
endif ()
# end of file