Skip to content

Commit 786b53b

Browse files
committed
Add CMake Project
Now implemented: - standalote installation as asio package; - optional building and installation cpp11 and cpp14 examples.
1 parent d52b816 commit 786b53b

File tree

8 files changed

+687
-0
lines changed

8 files changed

+687
-0
lines changed

asio/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Minimum supported CMake version
2+
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
3+
4+
# Project
5+
project(asio
6+
VERSION 1.11.0
7+
LANGUAGES CXX)
8+
9+
# Options
10+
set(asio_BUILD_EXAMPLES OFF CACHE BOOL "Build asio examples")
11+
12+
# Installation configuration
13+
include(GNUInstallDirs)
14+
if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR)
15+
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/asio)
16+
endif()
17+
18+
# Interface library
19+
add_subdirectory(include)
20+
21+
# Sources
22+
add_subdirectory(src)
23+
24+
# Installation
25+
configure_file(asio-config-version.cmake.in asio-config-version.cmake @ONLY)
26+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asio-config-version.cmake
27+
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
28+
install(EXPORT asio-targets
29+
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
30+
NAMESPACE asio::)
31+
install(FILES asio-config.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR})

asio/asio-config-version.cmake.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(PACKAGE_VERSION "@asio_VERSION@")
2+
3+
# Check whether the requested PACKAGE_FIND_VERSION is compatible
4+
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
6+
else()
7+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
8+
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9+
set(PACKAGE_VERSION_EXACT TRUE)
10+
endif()
11+
endif()

asio/asio-config.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include(${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake)

0 commit comments

Comments
 (0)