Skip to content

Commit cd8a6ef

Browse files
Starting reorg of chops-net-ip repo
1 parent 0a054fa commit cd8a6ef

File tree

11 files changed

+500
-324
lines changed

11 files changed

+500
-324
lines changed

.travis.yml

Lines changed: 0 additions & 153 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,57 @@
1-
# Copyright 2019-2020 by Cliff Green
1+
# Copyright (c) 2019-2024 by Cliff Green
22
#
33
# https://github.com/connectivecpp/chops-net-ip
44
#
5+
# I'm still learning CMake, so improvement suggestions are always welcome.
6+
#
7+
# The Asio CMake code is taken from CPM.cmake examples/asio-standalone.
8+
#
59
# Distributed under the Boost Software License, Version 1.0.
610
# (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
711

8-
# CMake 3.8 required for cxx_std_17 target_compile_features
9-
10-
cmake_minimum_required ( VERSION 3.12 )
11-
12-
option ( CHOPS_NET_IP_OPT_BUILD_TESTS "Build and perform chops-net-ip tests" ON )
13-
option ( CHOPS_NET_IP_OPT_BUILD_EXAMPLES "Build and perform chops-net-ip examples" ON )
14-
option ( CHOPS_NET_IP_OPT_BUILD_DOCS "Build doxygen documentation" OFF )
12+
cmake_minimum_required ( VERSION 3.14 FATAL_ERROR )
1513

16-
set ( OPTIONS "" )
17-
set ( DEFINITIONS "" )
14+
project ( chops_net_ip
15+
LANGUAGES CXX
16+
DESCRIPTION "An asynchronous networking library based on Asio"
17+
HOMEPAGE_URL "https://github.com/connectivecpp/chops-net-ip/" )
1818

19-
project ( chops-net-ip VERSION 1.0 LANGUAGES CXX )
19+
option ( CHOPS_NET_IP_BUILD_TESTS "Build unit tests" OFF )
20+
option ( CHOPS_NET_IP_BUILD_EXAMPLES "Build examples" OFF )
21+
option ( CHOPS_NET_IP_INSTALL "Install header only library" OFF )
2022

21-
set ( package_name "chops-net-ip" )
23+
# add library targets
2224

23-
set ( include_source_dir "${CMAKE_SOURCE_DIR}/include" )
24-
set ( utility_rack_dir "${CMAKE_SOURCE_DIR}/../utility-rack" )
25-
set ( utility_rack_include_source_dir "${utility_rack_dir}/include" )
26-
set ( third_party_include_source_dir "${utility_rack_dir}/third_party" )
27-
set ( cmake_include_dir "${CMAKE_SOURCE_DIR}/cmake" )
28-
set ( cmake_all_repos_include_dir "${utility_rack_dir}/cmake/all_repos" )
25+
add_library ( chops_net_ip INTERFACE )
26+
add_library ( chops::chops_net_ip ALIAS chops_net_ip )
2927

28+
# thread support specified in Asio download
3029

31-
# Interface library:
30+
include ( cmake/download_asio_cpm.cmake )
3231

33-
add_library ( ${package_name} INTERFACE )
32+
# configure library target
3433

35-
target_include_directories ( ${package_name} INTERFACE ${include_source_dir} )
36-
target_include_directories ( ${package_name} INTERFACE ${third_party_include_source_dir} )
37-
target_compile_features ( ${package_name} INTERFACE cxx_std_17)
34+
target_include_directories ( chops_net_ip INTERFACE
35+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
36+
$<INSTALL_INTERFACE:include/> )
37+
target_compile_features ( chops_net_ip INTERFACE cxx_std_20 )
3838

39-
if ( CHOPS_NET_IP_OPT_BUILD_TESTS )
39+
# check to build unit tests
40+
if ( ${CHOPS_NET_IP_BUILD_TESTS} )
4041
enable_testing()
4142
add_subdirectory ( test )
42-
endif()
43+
endif ()
4344

44-
if ( CHOPS_NET_IP_OPT_BUILD_EXAMPLES )
45+
# check to build example code
46+
if ( ${CHOPS_NET_IP_BUILD_EXAMPLES} )
4547
add_subdirectory ( example )
46-
endif()
48+
endif ()
4749

48-
if ( CHOPS_NET_IP_OPT_BUILD_DOCS )
49-
add_subdirectory ( doc )
50-
endif()
50+
# check to install
51+
if ( ${CHOPS_NET_IP_INSTALL} )
52+
set ( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt )
53+
include ( CPack )
54+
endif ()
5155

5256
# end of file
5357

0 commit comments

Comments
 (0)