-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a054fa
commit cd8a6ef
Showing
11 changed files
with
500 additions
and
324 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,57 @@ | ||
# Copyright 2019-2020 by Cliff Green | ||
# Copyright (c) 2019-2024 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 3.8 required for cxx_std_17 target_compile_features | ||
|
||
cmake_minimum_required ( VERSION 3.12 ) | ||
|
||
option ( CHOPS_NET_IP_OPT_BUILD_TESTS "Build and perform chops-net-ip tests" ON ) | ||
option ( CHOPS_NET_IP_OPT_BUILD_EXAMPLES "Build and perform chops-net-ip examples" ON ) | ||
option ( CHOPS_NET_IP_OPT_BUILD_DOCS "Build doxygen documentation" OFF ) | ||
cmake_minimum_required ( VERSION 3.14 FATAL_ERROR ) | ||
|
||
set ( OPTIONS "" ) | ||
set ( DEFINITIONS "" ) | ||
project ( chops_net_ip | ||
LANGUAGES CXX | ||
DESCRIPTION "An asynchronous networking library based on Asio" | ||
HOMEPAGE_URL "https://github.com/connectivecpp/chops-net-ip/" ) | ||
|
||
project ( chops-net-ip VERSION 1.0 LANGUAGES CXX ) | ||
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 ) | ||
|
||
set ( package_name "chops-net-ip" ) | ||
# add library targets | ||
|
||
set ( include_source_dir "${CMAKE_SOURCE_DIR}/include" ) | ||
set ( utility_rack_dir "${CMAKE_SOURCE_DIR}/../utility-rack" ) | ||
set ( utility_rack_include_source_dir "${utility_rack_dir}/include" ) | ||
set ( third_party_include_source_dir "${utility_rack_dir}/third_party" ) | ||
set ( cmake_include_dir "${CMAKE_SOURCE_DIR}/cmake" ) | ||
set ( cmake_all_repos_include_dir "${utility_rack_dir}/cmake/all_repos" ) | ||
add_library ( chops_net_ip INTERFACE ) | ||
add_library ( chops::chops_net_ip ALIAS chops_net_ip ) | ||
|
||
# thread support specified in Asio download | ||
|
||
# Interface library: | ||
include ( cmake/download_asio_cpm.cmake ) | ||
|
||
add_library ( ${package_name} INTERFACE ) | ||
# configure library target | ||
|
||
target_include_directories ( ${package_name} INTERFACE ${include_source_dir} ) | ||
target_include_directories ( ${package_name} INTERFACE ${third_party_include_source_dir} ) | ||
target_compile_features ( ${package_name} INTERFACE cxx_std_17) | ||
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 ) | ||
|
||
if ( CHOPS_NET_IP_OPT_BUILD_TESTS ) | ||
# check to build unit tests | ||
if ( ${CHOPS_NET_IP_BUILD_TESTS} ) | ||
enable_testing() | ||
add_subdirectory ( test ) | ||
endif() | ||
endif () | ||
|
||
if ( CHOPS_NET_IP_OPT_BUILD_EXAMPLES ) | ||
# check to build example code | ||
if ( ${CHOPS_NET_IP_BUILD_EXAMPLES} ) | ||
add_subdirectory ( example ) | ||
endif() | ||
endif () | ||
|
||
if ( CHOPS_NET_IP_OPT_BUILD_DOCS ) | ||
add_subdirectory ( doc ) | ||
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 | ||
|
Oops, something went wrong.