forked from NVIDIA/stdexec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigureASIO.cmake
More file actions
108 lines (90 loc) · 3.39 KB
/
ConfigureASIO.cmake
File metadata and controls
108 lines (90 loc) · 3.39 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
option(STDEXEC_ENABLE_ASIO "Enable ASIO targets" OFF)
set(STDEXEC_ASIO_IMPLEMENTATION "boost" CACHE STRING "boost")
set_property(CACHE STDEXEC_ASIO_IMPLEMENTATION PROPERTY STRINGS boost standalone)
if(STDEXEC_ENABLE_ASIO)
set(STDEXEC_ASIO_USES_BOOST FALSE)
set(STDEXEC_ASIO_USES_STANDALONE FALSE)
if(${STDEXEC_ASIO_IMPLEMENTATION} STREQUAL "boost")
set(STDEXEC_ASIO_USES_BOOST TRUE)
elseif(${STDEXEC_ASIO_IMPLEMENTATION} STREQUAL "standalone")
set(STDEXEC_ASIO_USES_STANDALONE TRUE)
else()
message(FATAL_ERROR "Unknown configuration for ASIO implementation: " ${STDEXEC_ASIO_IMPLEMENTATION})
endif()
set(STDEXEC_ASIO_CONFIG_HPP ${CMAKE_CURRENT_BINARY_DIR}/include/exec/asio/asio_config.hpp)
configure_file(
include/exec/asio/asio_config.hpp.in
${STDEXEC_ASIO_CONFIG_HPP}
)
file(GLOB_RECURSE asioexec_sources CONFIGURE_DEPENDS include/exec/asio/*.hpp)
if(${STDEXEC_ASIO_USES_BOOST})
set(BOOST_INCLUDE_LIBRARIES asio system)
set(BOOST_VERSION 1.86.0)
rapids_cpm_find(Boost ${BOOST_VERSION}
CPM_ARGS
URL https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}-cmake.tar.xz
OPTIONS "BOOST_SKIP_INSTALL_RULES OFF"
)
add_library(asioexec INTERFACE)
list(APPEND stdexec_export_targets asioexec)
add_library(STDEXEC::asioexec ALIAS asioexec)
# These aliases are provided for backwards compatibility with the old target names
add_library(asioexec_boost ALIAS asioexec)
add_library(stdexec_boost_pool ALIAS asioexec)
add_library(STDEXEC::asio_pool ALIAS asioexec)
add_library(STDEXEC::asioexec_boost ALIAS asioexec)
target_sources(asioexec PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${STDEXEC_ASIO_CONFIG_HPP}
)
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_BOOST)
target_link_libraries(asioexec INTERFACE
STDEXEC::stdexec
Boost::asio
)
if(STDEXEC_INSTALL)
install(TARGETS asioexec
EXPORT stdexec-exports
FILE_SET headers
)
endif()
elseif(${STDEXEC_ASIO_USES_STANDALONE})
include(cmake/import_standalone_asio.cmake)
import_standalone_asio(
TAG "asio-1-31-0"
VERSION "1.31.0")
add_library(asioexec INTERFACE)
list(APPEND stdexec_export_targets asioexec)
add_library(STDEXEC::asioexec ALIAS asioexec)
# These aliases are provided for backwards compatibility with the old target names
add_library(asioexec_asio ALIAS asioexec)
add_library(stdexec_asio_pool ALIAS asioexec)
add_library(STDEXEC::asio_pool ALIAS asioexec)
add_library(STDEXEC::asioexec_asio ALIAS asioexec)
target_sources(asioexec PUBLIC
FILE_SET headers
TYPE HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
FILES ${asioexec_sources}
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
FILES ${STDEXEC_ASIO_CONFIG_HPP}
)
target_compile_definitions(asioexec INTERFACE STDEXEC_ASIO_USES_STANDALONE)
target_link_libraries(asioexec INTERFACE
STDEXEC::stdexec
asio
)
if(STDEXEC_INSTALL)
install(TARGETS asioexec
EXPORT stdexec-exports
FILE_SET headers
)
endif()
else()
message(FATAL_ERROR "ASIO implementation is not configured")
endif()
endif()