@@ -39,103 +39,72 @@ if (Boost_VERSION_STRING VERSION_LESS 1.81.0)
39
39
INTERFACE_COMPILE_DEFINITIONS "BOOST_NO_CXX98_FUNCTION_BASE" )
40
40
endif ()
41
41
42
- # - set _seastar_dep_args_<package> for additional args for find_package().
43
- # add REQUIRED if the corresponding option is explicitly enabled, so
44
- # find_package() can stop the cmake generation.
45
- # - set _seastar_dep_skip_<package> if the option is explicitly disabled
46
- macro (seastar_set_dep_args package)
47
- cmake_parse_arguments (args "REQUIRED" "VERSION;OPTION" "COMPONENTS" ${ARGN} )
48
- if (DEFINED args_VERSION)
49
- list (APPEND _seastar_dep_args_${package} ${args_VERSION} )
50
- endif ()
51
- if (args_REQUIRED)
52
- list (APPEND _seastar_dep_args_${package} REQUIRED)
53
- elseif (DEFINED args_OPTION)
54
- if (args_OPTION)
55
- list (APPEND _seastar_dep_args_${package} REQUIRED)
42
+ if (CMAKE_FIND_PACKAGE_NAME )
43
+ # used inside find_package(Seastar)
44
+ include (CMakeFindDependencyMacro)
45
+
46
+ macro (seastar_find_dep package)
47
+ cmake_parse_arguments (args "REQUIRED" "" "" ${ARGN} )
48
+ if (arg_REQUIRED)
49
+ find_dependency (${package} ${arg_UNPARSED_ARGUMENTS} )
56
50
else ()
57
- set (_seastar_dep_skip_${package} TRUE )
51
+ # some packages are not REQUIRED, so we just check for them instead of
52
+ # populating "REQUIRED" from the original find_package() call.
53
+ find_package (${package} ${ARGN} )
58
54
endif ()
59
- endif ()
60
- if (args_COMPONENTS)
61
- list (APPEND _seastar_dep_args_${package} COMPONENTS
62
- ${args_COMPONENTS} )
63
- endif ()
64
- endmacro ()
55
+ endmacro ()
56
+ else ()
57
+ macro (seastar_find_dep package)
58
+ # used when configuring Seastar
59
+ find_package (${package} ${ARGN} )
60
+ endmacro ()
61
+ endif ()
65
62
66
- #
67
- # Iterate through the dependency list defined below and execute `find_package`
68
- # with the corresponding configuration for each 3rd-party dependency.
69
- #
70
63
macro (seastar_find_dependencies)
71
64
#
72
65
# List of Seastar dependencies that is meant to be used
73
66
# both in Seastar configuration and by clients which
74
67
# consume Seastar via SeastarConfig.cmake.
75
68
#
76
- set (_seastar_all_dependencies
77
- # Public dependencies.
78
- Boost
79
- c-ares
80
- dpdk # No version information published.
81
- fmt
82
- lz4
83
- # Private and private/public dependencies.
84
- GnuTLS
85
- LibUring
86
- LinuxMembarrier
87
- # Protobuf is searched manually.
88
- Sanitizers
89
- SourceLocation
90
- StdAtomic
91
- SystemTap-SDT
92
- hwloc
93
- lksctp-tools # No version information published.
94
- rt
95
- ucontext
96
- yaml-cpp)
97
-
98
- # Arguments to `find_package` for each 3rd-party dependency.
99
- # Note that the version specification is a "minimal" version requirement.
100
-
101
69
# `unit_test_framework` is not required in the case we are building Seastar
102
70
# without the testing library, however the component is always specified as required
103
71
# to keep the CMake code minimalistic and easy-to-use.
104
- seastar_set_dep_args (Boost REQUIRED
105
- VERSION ${_seastar_boost_version}
72
+ seastar_find_dep (Boost ${_seastar_boost_version} REQUIRED
106
73
COMPONENTS
107
74
filesystem
108
75
program_options
109
76
thread
110
77
unit_test_framework)
111
- seastar_set_dep_args (c-ares REQUIRED
112
- VERSION 1.13)
113
- seastar_set_dep_args (dpdk
114
- OPTION ${Seastar_DPDK} )
115
- seastar_set_dep_args (fmt REQUIRED
116
- VERSION 8.1.1)
117
- seastar_set_dep_args (lz4 REQUIRED
118
- VERSION 1.7.3)
119
- seastar_set_dep_args (GnuTLS REQUIRED
120
- VERSION 3.3.26)
121
- seastar_set_dep_args (LibUring
122
- VERSION 2.0
123
- OPTION ${Seastar_IO_URING} )
124
- seastar_set_dep_args (StdAtomic REQUIRED)
125
- seastar_set_dep_args (hwloc
126
- VERSION 1.11.2
127
- OPTION ${Seastar_HWLOC} )
128
- seastar_set_dep_args (lksctp-tools REQUIRED)
129
- seastar_set_dep_args (rt REQUIRED)
130
- seastar_set_dep_args (ucontext REQUIRED)
131
- seastar_set_dep_args (yaml-cpp REQUIRED
132
- VERSION 0.5.1)
78
+ seastar_find_dep (c-ares 1.13 REQUIRED)
79
+ if (c-ares_VERSION VERSION_GREATER_EQUAL 1.33.0 AND c-ares_VERSION VERSION_LESS 1.34.1)
80
+ # https://github.com/scylladb/seastar/issues/2472
81
+ message (FATAL_ERROR
82
+ "c-ares ${c-ares_VERSION} is not supported. "
83
+ "Seastar requires c-ares version <1.33 or >=1.34.1 " )
84
+ endif ()
133
85
134
- foreach (third_party ${_seastar_all_dependencies} )
135
- if (NOT _seastar_dep_skip_${third_party} )
136
- find_package ("${third_party} " ${_seastar_dep_args_${third_party} })
137
- endif ()
138
- endforeach ()
86
+ if (Seastar_DPDK)
87
+ seastar_find_dep (dpdk)
88
+ endif ()
89
+ seastar_find_dep (fmt 8.1.1 REQUIRED)
90
+ seastar_find_dep (lz4 1.7.3 REQUIRED)
91
+ seastar_find_dep (GnuTLS 3.3.26 REQUIRED)
92
+ if (Seastar_IO_URING)
93
+ seastar_find_dep (LibUring 2.0 REQUIRED)
94
+ endif ()
95
+ seastar_find_dep (LinuxMembarrier)
96
+ seastar_find_dep (Sanitizers)
97
+ seastar_find_dep (SourceLocation)
98
+ seastar_find_dep (StdAtomic REQUIRED)
99
+ seastar_find_dep (SystemTap-SDT)
100
+ if (Seastar_HWLOC)
101
+ seastar_find_dep (hwloc 1.11.2 REQUIRED)
102
+ endif ()
103
+ seastar_find_dep (lksctp-tools REQUIRED)
104
+ seastar_find_dep (rt REQUIRED)
105
+ seastar_find_dep (ucontext REQUIRED)
106
+ seastar_find_dep (yaml-cpp REQUIRED
107
+ VERSION 0.5.1)
139
108
140
109
# workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25079
141
110
# since protobuf v22.0, it started using abseil, see
@@ -148,15 +117,9 @@ macro (seastar_find_dependencies)
148
117
find_package (Protobuf QUIET CONFIG)
149
118
if (Protobuf_FOUND AND Protobuf_VERSION VERSION_GREATER_EQUAL 2.5.0)
150
119
# do it again, so the message is printed when the package is found
151
- find_package (Protobuf CONFIG REQUIRED)
120
+ seastar_find_dep (Protobuf CONFIG REQUIRED)
152
121
else ()
153
- find_package (Protobuf 2.5.0 REQUIRED)
122
+ seastar_find_dep (Protobuf 2.5.0 REQUIRED)
154
123
endif ()
155
124
156
- if (c-ares_VERSION VERSION_GREATER_EQUAL 1.33.0 AND c-ares_VERSION VERSION_LESS 1.34.1)
157
- # https://github.com/scylladb/seastar/issues/2472
158
- message (FATAL_ERROR
159
- "c-ares ${c-ares_VERSION} is not supported. "
160
- "Seastar requires c-ares version <1.33 or >=1.34.1 " )
161
- endif ()
162
125
endmacro ()
0 commit comments