summaryrefslogtreecommitdiffstats
path: root/src/seastar/cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/seastar/cmake
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/seastar/cmake')
-rw-r--r--src/seastar/cmake/FindConcepts.cmake36
-rw-r--r--src/seastar/cmake/FindGnuTLS.cmake61
-rw-r--r--src/seastar/cmake/FindLinuxMembarrier.cmake40
-rw-r--r--src/seastar/cmake/FindProtobuf.cmake578
-rw-r--r--src/seastar/cmake/FindPthreadSetName.cmake12
-rw-r--r--src/seastar/cmake/FindSanitizers.cmake73
-rw-r--r--src/seastar/cmake/FindStdAtomic.cmake51
-rw-r--r--src/seastar/cmake/Findc-ares.cmake61
-rw-r--r--src/seastar/cmake/Findcryptopp.cmake51
-rw-r--r--src/seastar/cmake/Finddpdk.cmake493
-rw-r--r--src/seastar/cmake/Findhwloc.cmake61
-rw-r--r--src/seastar/cmake/Findlksctp-tools.cmake54
-rw-r--r--src/seastar/cmake/Findlz4.cmake70
-rw-r--r--src/seastar/cmake/Findnumactl.cmake50
-rw-r--r--src/seastar/cmake/Findragel.cmake45
-rw-r--r--src/seastar/cmake/Findrt.cmake57
-rw-r--r--src/seastar/cmake/Findyaml-cpp.cmake62
-rw-r--r--src/seastar/cmake/SeastarConfig.cmake.in37
-rw-r--r--src/seastar/cmake/SeastarDependencies.cmake100
-rw-r--r--src/seastar/cmake/code_tests/Concepts_test.cc3
-rw-r--r--src/seastar/cmake/code_tests/LinuxMembarrier_test.cc8
-rw-r--r--src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc11
-rw-r--r--src/seastar/cmake/code_tests/rt_test.cc10
-rw-r--r--src/seastar/cmake/dpdk_configure.cmake41
24 files changed, 2065 insertions, 0 deletions
diff --git a/src/seastar/cmake/FindConcepts.cmake b/src/seastar/cmake/FindConcepts.cmake
new file mode 100644
index 000000000..0c520e2ec
--- /dev/null
+++ b/src/seastar/cmake/FindConcepts.cmake
@@ -0,0 +1,36 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+include (CheckCXXSourceCompiles)
+file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Concepts_test.cc _concepts_test_code)
+set (CMAKE_REQUIRED_FLAGS -fconcepts)
+check_cxx_source_compiles ("${_concepts_test_code}" Concepts_FOUND)
+set (CMAKE_REQUIRED_FLAGS "")
+
+if (Concepts_FOUND AND NOT (TARGET Concepts::concepts))
+ set (CMAKE_REQUIRED_FLAGS -fconcepts)
+ add_library (Concepts::concepts INTERFACE IMPORTED)
+
+ set_target_properties (Concepts::concepts
+ PROPERTIES
+ INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CXX>:-fconcepts>)
+endif ()
diff --git a/src/seastar/cmake/FindGnuTLS.cmake b/src/seastar/cmake/FindGnuTLS.cmake
new file mode 100644
index 000000000..92d263038
--- /dev/null
+++ b/src/seastar/cmake/FindGnuTLS.cmake
@@ -0,0 +1,61 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_package (PkgConfig REQUIRED)
+
+pkg_search_module (GnuTLS_PC gnutls)
+
+find_library (GnuTLS_LIBRARY
+ NAMES gnutls
+ HINTS
+ ${GnuTLS_PC_LIBDIR}
+ ${GnuTLS_PC_LIBRARY_DIRS})
+
+find_path (GnuTLS_INCLUDE_DIR
+ NAMES gnutls/gnutls.h
+ HINTS
+ ${GnuTLS_PC_INCLUDEDIR}
+ ${GnuTLS_PC_INCLUDE_DIRS})
+
+mark_as_advanced (
+ GnuTLS_LIBRARY
+ GnuTLS_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (GnuTLS
+ REQUIRED_VARS
+ GnuTLS_LIBRARY
+ GnuTLS_INCLUDE_DIR
+ VERSION_VAR GnuTLS_PC_VERSION)
+
+set (GnuTLS_LIBRARIES ${GnuTLS_LIBRARY})
+set (GnuTLS_INCLUDE_DIRS ${GnuTLS_INCLUDE_DIR})
+
+if (GnuTLS_FOUND AND NOT (TARGET GnuTLS::gnutls))
+ add_library (GnuTLS::gnutls UNKNOWN IMPORTED)
+
+ set_target_properties (GnuTLS::gnutls
+ PROPERTIES
+ IMPORTED_LOCATION ${GnuTLS_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${GnuTLS_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/FindLinuxMembarrier.cmake b/src/seastar/cmake/FindLinuxMembarrier.cmake
new file mode 100644
index 000000000..d4645cffa
--- /dev/null
+++ b/src/seastar/cmake/FindLinuxMembarrier.cmake
@@ -0,0 +1,40 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_path (LinuxMembarrier_INCLUDE_DIR
+ NAMES linux/membarrier.h)
+
+include (CheckCXXSourceCompiles)
+file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/LinuxMembarrier_test.cc _linuxmembarrier_test_code)
+check_cxx_source_compiles ("${_linuxmembarrier_test_code}" LinuxMembarrier_FOUND)
+
+if (LinuxMembarrier_FOUND)
+ set (LinuxMembarrier_INCLUDE_DIRS ${LinuxMembarrier_INCLUDE_DIR})
+endif ()
+
+if (LinuxMembarrier_FOUND AND NOT (TARGET LinuxMembarrier::membarrier))
+ add_library (LinuxMembarrier::membarrier INTERFACE IMPORTED)
+
+ set_target_properties (LinuxMembarrier::membarrier
+ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${LinuxMembarrier_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/FindProtobuf.cmake b/src/seastar/cmake/FindProtobuf.cmake
new file mode 100644
index 000000000..76d1a3ccf
--- /dev/null
+++ b/src/seastar/cmake/FindProtobuf.cmake
@@ -0,0 +1,578 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# FindProtobuf
+# ------------
+#
+# Locate and configure the Google Protocol Buffers library.
+#
+# The following variables can be set and are optional:
+#
+# ``Protobuf_SRC_ROOT_FOLDER``
+# When compiling with MSVC, if this cache variable is set
+# the protobuf-default VS project build locations
+# (vsprojects/Debug and vsprojects/Release
+# or vsprojects/x64/Debug and vsprojects/x64/Release)
+# will be searched for libraries and binaries.
+# ``Protobuf_IMPORT_DIRS``
+# List of additional directories to be searched for
+# imported .proto files.
+# ``Protobuf_DEBUG``
+# Show debug messages.
+# ``Protobuf_USE_STATIC_LIBS``
+# Set to ON to force the use of the static libraries.
+# Default is OFF.
+#
+# Defines the following variables:
+#
+# ``Protobuf_FOUND``
+# Found the Google Protocol Buffers library
+# (libprotobuf & header files)
+# ``Protobuf_VERSION``
+# Version of package found.
+# ``Protobuf_INCLUDE_DIRS``
+# Include directories for Google Protocol Buffers
+# ``Protobuf_LIBRARIES``
+# The protobuf libraries
+# ``Protobuf_PROTOC_LIBRARIES``
+# The protoc libraries
+# ``Protobuf_LITE_LIBRARIES``
+# The protobuf-lite libraries
+#
+# The following :prop_tgt:`IMPORTED` targets are also defined:
+#
+# ``protobuf::libprotobuf``
+# The protobuf library.
+# ``protobuf::libprotobuf-lite``
+# The protobuf lite library.
+# ``protobuf::libprotoc``
+# The protoc library.
+# ``protobuf::protoc``
+# The protoc compiler.
+#
+# The following cache variables are also available to set or use:
+#
+# ``Protobuf_LIBRARY``
+# The protobuf library
+# ``Protobuf_PROTOC_LIBRARY``
+# The protoc library
+# ``Protobuf_INCLUDE_DIR``
+# The include directory for protocol buffers
+# ``Protobuf_PROTOC_EXECUTABLE``
+# The protoc compiler
+# ``Protobuf_LIBRARY_DEBUG``
+# The protobuf library (debug)
+# ``Protobuf_PROTOC_LIBRARY_DEBUG``
+# The protoc library (debug)
+# ``Protobuf_LITE_LIBRARY``
+# The protobuf lite library
+# ``Protobuf_LITE_LIBRARY_DEBUG``
+# The protobuf lite library (debug)
+#
+# Example:
+#
+# .. code-block:: cmake
+#
+# find_package(Protobuf REQUIRED)
+# include_directories(${Protobuf_INCLUDE_DIRS})
+# include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
+# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
+# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS DESCRIPTORS PROTO_DESCS foo.proto)
+# protobuf_generate_python(PROTO_PY foo.proto)
+# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
+# target_link_libraries(bar ${Protobuf_LIBRARIES})
+#
+# .. note::
+# The ``protobuf_generate_cpp`` and ``protobuf_generate_python``
+# functions and :command:`add_executable` or :command:`add_library`
+# calls only work properly within the same directory.
+#
+# .. command:: protobuf_generate_cpp
+#
+# Add custom commands to process ``.proto`` files to C++::
+#
+# protobuf_generate_cpp (<SRCS> <HDRS>
+# [DESCRIPTORS <DESC>] [EXPORT_MACRO <MACRO>] [<ARGN>...])
+#
+# ``SRCS``
+# Variable to define with autogenerated source files
+# ``HDRS``
+# Variable to define with autogenerated header files
+# ``DESCRIPTORS``
+# Variable to define with autogenerated descriptor files, if requested.
+# ``EXPORT_MACRO``
+# is a macro which should expand to ``__declspec(dllexport)`` or
+# ``__declspec(dllimport)`` depending on what is being compiled.
+# ``ARGN``
+# ``.proto`` files
+#
+# .. command:: protobuf_generate_python
+#
+# Add custom commands to process ``.proto`` files to Python::
+#
+# protobuf_generate_python (<PY> [<ARGN>...])
+#
+# ``PY``
+# Variable to define with autogenerated Python files
+# ``ARGN``
+# ``.proto`` filess
+
+function(PROTOBUF_GENERATE_CPP SRCS HDRS)
+ cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN})
+
+ set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}")
+ if(NOT PROTO_FILES)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
+ return()
+ endif()
+
+ if(protobuf_EXPORT_MACRO)
+ set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:")
+ endif()
+
+ if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ # Create an include path for each file specified
+ foreach(FIL ${PROTO_FILES})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(ABS_PATH ${ABS_FIL} PATH)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ else()
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
+ set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
+ endif()
+
+ if(DEFINED Protobuf_IMPORT_DIRS)
+ foreach(DIR ${Protobuf_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ endif()
+
+ set(${SRCS})
+ set(${HDRS})
+ if (protobuf_DESCRIPTORS)
+ set(${protobuf_DESCRIPTORS})
+ endif()
+
+ foreach(FIL ${PROTO_FILES})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(FIL_WE ${FIL} NAME_WE)
+ if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ get_filename_component(FIL_DIR ${FIL} DIRECTORY)
+ if(FIL_DIR)
+ set(FIL_WE "${FIL_DIR}/${FIL_WE}")
+ endif()
+ endif()
+
+ set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
+ set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
+ list(APPEND ${SRCS} "${_protobuf_protoc_src}")
+ list(APPEND ${HDRS} "${_protobuf_protoc_hdr}")
+
+ if(protobuf_DESCRIPTORS)
+ set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc")
+ set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}")
+ list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}")
+ else()
+ set(_protobuf_protoc_desc "")
+ set(_protobuf_protoc_flags "")
+ endif()
+
+ add_custom_command(
+ OUTPUT "${_protobuf_protoc_src}"
+ "${_protobuf_protoc_hdr}"
+ ${_protobuf_protoc_desc}
+ COMMAND protobuf::protoc
+ "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}"
+ ${_protobuf_protoc_flags}
+ ${_protobuf_include_path} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} protobuf::protoc
+ COMMENT "Running C++ protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endforeach()
+
+ set(${SRCS} "${${SRCS}}" PARENT_SCOPE)
+ set(${HDRS} "${${HDRS}}" PARENT_SCOPE)
+ if(protobuf_DESCRIPTORS)
+ set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(PROTOBUF_GENERATE_PYTHON SRCS)
+ if(NOT ARGN)
+ message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files")
+ return()
+ endif()
+
+ if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ # Create an include path for each file specified
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(ABS_PATH ${ABS_FIL} PATH)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ else()
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS)
+ set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}")
+ endif()
+
+ if(DEFINED Protobuf_IMPORT_DIRS)
+ foreach(DIR ${Protobuf_IMPORT_DIRS})
+ get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
+ list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+ if(${_contains_already} EQUAL -1)
+ list(APPEND _protobuf_include_path -I ${ABS_PATH})
+ endif()
+ endforeach()
+ endif()
+
+ set(${SRCS})
+ foreach(FIL ${ARGN})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(FIL_WE ${FIL} NAME_WE)
+ if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ get_filename_component(FIL_DIR ${FIL} DIRECTORY)
+ if(FIL_DIR)
+ set(FIL_WE "${FIL_DIR}/${FIL_WE}")
+ endif()
+ endif()
+
+ list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py")
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py"
+ COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} protobuf::protoc
+ COMMENT "Running Python protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endforeach()
+
+ set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+endfunction()
+
+
+if(Protobuf_DEBUG)
+ # Output some of their choices
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "Protobuf_USE_STATIC_LIBS = ${Protobuf_USE_STATIC_LIBS}")
+endif()
+
+
+# Backwards compatibility
+# Define camel case versions of input variables
+foreach(UPPER
+ PROTOBUF_SRC_ROOT_FOLDER
+ PROTOBUF_IMPORT_DIRS
+ PROTOBUF_DEBUG
+ PROTOBUF_LIBRARY
+ PROTOBUF_PROTOC_LIBRARY
+ PROTOBUF_INCLUDE_DIR
+ PROTOBUF_PROTOC_EXECUTABLE
+ PROTOBUF_LIBRARY_DEBUG
+ PROTOBUF_PROTOC_LIBRARY_DEBUG
+ PROTOBUF_LITE_LIBRARY
+ PROTOBUF_LITE_LIBRARY_DEBUG
+ )
+ if (DEFINED ${UPPER})
+ string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER})
+ if (NOT DEFINED ${Camel})
+ set(${Camel} ${${UPPER}})
+ endif()
+ endif()
+endforeach()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_PROTOBUF_ARCH_DIR x64/)
+endif()
+
+
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if( Protobuf_USE_STATIC_LIBS )
+ set( _protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ if(WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ else()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
+ endif()
+endif()
+
+include(SelectLibraryConfigurations)
+
+# Internal function: search for normal library as well as a debug one
+# if the debug one is specified also include debug/optimized keywords
+# in *_LIBRARIES variable
+function(_protobuf_find_libraries name filename)
+ if(${name}_LIBRARIES)
+ # Use result recorded by a previous call.
+ return()
+ elseif(${name}_LIBRARY)
+ # Honor cache entry used by CMake 3.5 and lower.
+ set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE)
+ else()
+ find_library(${name}_LIBRARY_RELEASE
+ NAMES ${filename}
+ PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release)
+ mark_as_advanced(${name}_LIBRARY_RELEASE)
+
+ find_library(${name}_LIBRARY_DEBUG
+ NAMES ${filename}d ${filename}
+ PATHS ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug)
+ mark_as_advanced(${name}_LIBRARY_DEBUG)
+
+ select_library_configurations(${name})
+ set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
+ set(${name}_LIBRARIES "${${name}_LIBRARIES}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Internal function: find threads library
+function(_protobuf_find_threads)
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ find_package(Threads)
+ if(Threads_FOUND)
+ list(APPEND Protobuf_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+ set(Protobuf_LIBRARIES "${Protobuf_LIBRARIES}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+#
+# Main.
+#
+
+# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc
+# for each directory where a proto file is referenced.
+if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH)
+ set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE)
+endif()
+
+
+# Google's provided vcproj files generate libraries with a "lib"
+# prefix on Windows
+if(MSVC)
+ set(Protobuf_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
+
+ find_path(Protobuf_SRC_ROOT_FOLDER protobuf.pc.in)
+endif()
+
+# The Protobuf library
+_protobuf_find_libraries(Protobuf protobuf)
+#DOC "The Google Protocol Buffers RELEASE Library"
+
+_protobuf_find_libraries(Protobuf_LITE protobuf-lite)
+
+# The Protobuf Protoc Library
+_protobuf_find_libraries(Protobuf_PROTOC protoc)
+
+# Restore original find library prefixes
+if(MSVC)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${Protobuf_ORIG_FIND_LIBRARY_PREFIXES}")
+endif()
+
+if(UNIX)
+ _protobuf_find_threads()
+endif()
+
+# Find the include directory
+find_path(Protobuf_INCLUDE_DIR
+ google/protobuf/service.h
+ PATHS ${Protobuf_SRC_ROOT_FOLDER}/src
+)
+mark_as_advanced(Protobuf_INCLUDE_DIR)
+
+# Find the protoc Executable
+find_program(Protobuf_PROTOC_EXECUTABLE
+ NAMES protoc
+ DOC "The Google Protocol Buffers Compiler"
+ PATHS
+ ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Release
+ ${Protobuf_SRC_ROOT_FOLDER}/vsprojects/${_PROTOBUF_ARCH_DIR}Debug
+)
+mark_as_advanced(Protobuf_PROTOC_EXECUTABLE)
+
+if(Protobuf_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "requested version of Google Protobuf is ${Protobuf_FIND_VERSION}")
+endif()
+
+if(Protobuf_INCLUDE_DIR)
+ set(_PROTOBUF_COMMON_HEADER ${Protobuf_INCLUDE_DIR}/google/protobuf/stubs/common.h)
+
+ if(Protobuf_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "location of common.h: ${_PROTOBUF_COMMON_HEADER}")
+ endif()
+
+ set(Protobuf_VERSION "")
+ set(Protobuf_LIB_VERSION "")
+ file(STRINGS ${_PROTOBUF_COMMON_HEADER} _PROTOBUF_COMMON_H_CONTENTS REGEX "#define[ \t]+GOOGLE_PROTOBUF_VERSION[ \t]+")
+ if(_PROTOBUF_COMMON_H_CONTENTS MATCHES "#define[ \t]+GOOGLE_PROTOBUF_VERSION[ \t]+([0-9]+)")
+ set(Protobuf_LIB_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ unset(_PROTOBUF_COMMON_H_CONTENTS)
+
+ math(EXPR _PROTOBUF_MAJOR_VERSION "${Protobuf_LIB_VERSION} / 1000000")
+ math(EXPR _PROTOBUF_MINOR_VERSION "${Protobuf_LIB_VERSION} / 1000 % 1000")
+ math(EXPR _PROTOBUF_SUBMINOR_VERSION "${Protobuf_LIB_VERSION} % 1000")
+ set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
+
+ if(Protobuf_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "${_PROTOBUF_COMMON_HEADER} reveals protobuf ${Protobuf_VERSION}")
+ endif()
+
+ # Check Protobuf compiler version to be aligned with libraries version
+ execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} --version
+ OUTPUT_VARIABLE _PROTOBUF_PROTOC_EXECUTABLE_VERSION)
+
+ if("${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" MATCHES "libprotoc ([0-9.]+)")
+ set(_PROTOBUF_PROTOC_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
+ endif()
+
+ if(Protobuf_DEBUG)
+ message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+ "${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}")
+ endif()
+
+ if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}")
+ message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}"
+ " doesn't match library version ${Protobuf_VERSION}")
+ endif()
+
+ if(Protobuf_LIBRARY)
+ if(NOT TARGET protobuf::libprotobuf)
+ add_library(protobuf::libprotobuf UNKNOWN IMPORTED)
+ set_target_properties(protobuf::libprotobuf PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_LIBRARY}")
+ set_target_properties(protobuf::libprotobuf PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_LIBRARY_RELEASE}")
+ set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(protobuf::libprotobuf PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_LIBRARY_DEBUG}")
+ set_property(TARGET protobuf::libprotobuf APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(protobuf::libprotobuf PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
+
+ if(Protobuf_LITE_LIBRARY)
+ if(NOT TARGET protobuf::libprotobuf-lite)
+ add_library(protobuf::libprotobuf-lite UNKNOWN IMPORTED)
+ set_target_properties(protobuf::libprotobuf-lite PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_LITE_LIBRARY}")
+ set_target_properties(protobuf::libprotobuf-lite PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_LITE_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_LITE_LIBRARY_RELEASE}")
+ set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(protobuf::libprotobuf-lite PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_LITE_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_LITE_LIBRARY_DEBUG}")
+ set_property(TARGET protobuf::libprotobuf-lite APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(protobuf::libprotobuf-lite PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
+
+ if(Protobuf_PROTOC_LIBRARY)
+ if(NOT TARGET protobuf::libprotoc)
+ add_library(protobuf::libprotoc UNKNOWN IMPORTED)
+ set_target_properties(protobuf::libprotoc PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}")
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY}")
+ set_target_properties(protobuf::libprotoc PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}")
+ endif()
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY_RELEASE}")
+ set_property(TARGET protobuf::libprotoc APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(protobuf::libprotoc PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_LIBRARY_RELEASE}")
+ endif()
+ if(EXISTS "${Protobuf_PROTOC_LIBRARY_DEBUG}")
+ set_property(TARGET protobuf::libprotoc APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(protobuf::libprotoc PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}")
+ endif()
+ endif()
+ endif()
+
+ if(Protobuf_PROTOC_EXECUTABLE)
+ if(NOT TARGET protobuf::protoc)
+ add_executable(protobuf::protoc IMPORTED)
+ if(EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
+ set_target_properties(protobuf::protoc PROPERTIES
+ IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
+ endif()
+ endif()
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf
+ REQUIRED_VARS Protobuf_LIBRARIES Protobuf_INCLUDE_DIR
+ VERSION_VAR Protobuf_VERSION
+)
+
+if(Protobuf_FOUND)
+ set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIR})
+endif()
+
+# Restore the original find library ordering
+if( Protobuf_USE_STATIC_LIBS )
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_protobuf_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
+# Backwards compatibility
+# Define upper case versions of output variables
+foreach(Camel
+ Protobuf_SRC_ROOT_FOLDER
+ Protobuf_IMPORT_DIRS
+ Protobuf_DEBUG
+ Protobuf_INCLUDE_DIRS
+ Protobuf_LIBRARIES
+ Protobuf_PROTOC_LIBRARIES
+ Protobuf_LITE_LIBRARIES
+ Protobuf_LIBRARY
+ Protobuf_PROTOC_LIBRARY
+ Protobuf_INCLUDE_DIR
+ Protobuf_PROTOC_EXECUTABLE
+ Protobuf_LIBRARY_DEBUG
+ Protobuf_PROTOC_LIBRARY_DEBUG
+ Protobuf_LITE_LIBRARY
+ Protobuf_LITE_LIBRARY_DEBUG
+ )
+ string(TOUPPER ${Camel} UPPER)
+ set(${UPPER} ${${Camel}})
+endforeach()
diff --git a/src/seastar/cmake/FindPthreadSetName.cmake b/src/seastar/cmake/FindPthreadSetName.cmake
new file mode 100644
index 000000000..547b9f5a3
--- /dev/null
+++ b/src/seastar/cmake/FindPthreadSetName.cmake
@@ -0,0 +1,12 @@
+include (CMakePushCheckState)
+
+cmake_push_check_state (RESET)
+set (CMAKE_REQUIRED_FLAGS "-pthread")
+set (CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+check_symbol_exists (pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
+cmake_pop_check_state ()
+
+find_package_handle_standard_args (PthreadSetName
+ FOUND_VAR PthreadSetName_FOUND
+ REQUIRED_VARS
+ HAVE_PTHREAD_SETNAME_NP)
diff --git a/src/seastar/cmake/FindSanitizers.cmake b/src/seastar/cmake/FindSanitizers.cmake
new file mode 100644
index 000000000..316f88ea2
--- /dev/null
+++ b/src/seastar/cmake/FindSanitizers.cmake
@@ -0,0 +1,73 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+include (CheckCXXSourceCompiles)
+
+set (CMAKE_REQUIRED_FLAGS -fsanitize=address)
+check_cxx_source_compiles ("int main() {}" Sanitizers_ADDRESS_FOUND)
+
+if (Sanitizers_ADDRESS_FOUND)
+ set (Sanitizers_ADDRESS_COMPILER_OPTIONS -fsanitize=address)
+endif ()
+
+set (CMAKE_REQUIRED_FLAGS -fsanitize=undefined)
+check_cxx_source_compiles ("int main() {}" Sanitizers_UNDEFINED_BEHAVIOR_FOUND)
+
+if (Sanitizers_UNDEFINED_BEHAVIOR_FOUND)
+ # Disable vptr because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88684
+ set (Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS "-fsanitize=undefined;-fno-sanitize=vptr")
+endif ()
+
+set (Sanitizers_COMPILER_OPTIONS
+ ${Sanitizers_ADDRESS_COMPILER_OPTIONS}
+ ${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS})
+
+file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Sanitizers_fiber_test.cc _sanitizers_fiber_test_code)
+set (CMAKE_REQUIRED_FLAGS ${Sanitizers_COMPILER_OPTIONS})
+check_cxx_source_compiles ("${_sanitizers_fiber_test_code}" Sanitizers_FIBER_SUPPORT)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (Sanitizers
+ REQUIRED_VARS
+ Sanitizers_ADDRESS_COMPILER_OPTIONS
+ Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS)
+
+if (Sanitizers_FOUND)
+ if (NOT (TARGET Sanitizers::address))
+ add_library (Sanitizers::address INTERFACE IMPORTED)
+
+ set_target_properties (Sanitizers::address
+ PROPERTIES
+ INTERFACE_COMPILE_OPTIONS ${Sanitizers_ADDRESS_COMPILER_OPTIONS}
+ INTERFACE_LINK_LIBRARIES ${Sanitizers_ADDRESS_COMPILER_OPTIONS})
+ endif ()
+
+ if (NOT (TARGET Sanitizers::undefined_behavior))
+ add_library (Sanitizers::undefined_behavior INTERFACE IMPORTED)
+
+ set_target_properties (Sanitizers::undefined_behavior
+ PROPERTIES
+ INTERFACE_COMPILE_OPTIONS "${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS}"
+ INTERFACE_LINK_LIBRARIES "${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS}")
+ endif ()
+endif ()
diff --git a/src/seastar/cmake/FindStdAtomic.cmake b/src/seastar/cmake/FindStdAtomic.cmake
new file mode 100644
index 000000000..2d14c0b2b
--- /dev/null
+++ b/src/seastar/cmake/FindStdAtomic.cmake
@@ -0,0 +1,51 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2019 Scylladb, Ltd.
+#
+
+function (_stdatomic_can_link var)
+ include (CheckCXXSourceCompiles)
+ set (test_code "int main() {}")
+ set (CMAKE_REQUIRED_LIBRARIES -latomic)
+ check_cxx_source_compiles ("${test_code}" ${var})
+endfunction ()
+
+_stdatomic_can_link (StdAtomic_EXPLICIT_LINK)
+
+#
+# If linking against `-latomic` is successful, then do it unconditionally.
+#
+
+if (StdAtomic_EXPLICIT_LINK)
+ set (StdAtomic_LIBRARY_NAME atomic)
+ set (StdAtomic_LIBRARIES -l${StdAtomic_LIBRARY_NAME})
+ include (FindPackageHandleStandardArgs)
+
+ find_package_handle_standard_args (StdAtomic
+ REQUIRED_VARS StdAtomic_LIBRARIES)
+endif ()
+
+if (NOT (TARGET StdAtomic::atomic))
+ add_library (StdAtomic::atomic INTERFACE IMPORTED)
+
+ set_target_properties (StdAtomic::atomic
+ PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${StdAtomic_LIBRARIES}")
+endif ()
diff --git a/src/seastar/cmake/Findc-ares.cmake b/src/seastar/cmake/Findc-ares.cmake
new file mode 100644
index 000000000..734c54695
--- /dev/null
+++ b/src/seastar/cmake/Findc-ares.cmake
@@ -0,0 +1,61 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_package (PkgConfig REQUIRED)
+
+pkg_check_modules (c-ares_PC libcares)
+
+find_library (c-ares_LIBRARY
+ NAMES cares
+ HINTS
+ ${c-ares_PC_LIBDIR}
+ ${c-ares_PC_LIBRARY_DIRS})
+
+find_path (c-ares_INCLUDE_DIR
+ NAMES ares_dns.h
+ HINTS
+ ${c-ares_PC_INCLUDEDIR}
+ ${c-ares_PC_INCLUDE_DIRS})
+
+mark_as_advanced (
+ c-ares_LIBRARY
+ c-ares_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (c-ares
+ REQUIRED_VARS
+ c-ares_LIBRARY
+ c-ares_INCLUDE_DIR
+ VERSION_VAR c-ares_PC_VERSION)
+
+set (c-ares_LIBRARIES ${c-ares_LIBRARY})
+set (c-ares_INCLUDE_DIRS ${c-ares_INCLUDE_DIR})
+
+if (c-ares_FOUND AND NOT (TARGET c-ares::c-ares))
+ add_library (c-ares::c-ares UNKNOWN IMPORTED)
+
+ set_target_properties (c-ares::c-ares
+ PROPERTIES
+ IMPORTED_LOCATION ${c-ares_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${c-ares_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/Findcryptopp.cmake b/src/seastar/cmake/Findcryptopp.cmake
new file mode 100644
index 000000000..def4072ed
--- /dev/null
+++ b/src/seastar/cmake/Findcryptopp.cmake
@@ -0,0 +1,51 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_library (cryptopp_LIBRARY
+ NAMES cryptopp)
+
+find_path (cryptopp_INCLUDE_DIR
+ NAMES cryptopp/aes.h
+ PATH_SUFFIXES cryptopp)
+
+mark_as_advanced (
+ cryptopp_LIBRARY
+ cryptopp_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (cryptopp
+ REQUIRED_VARS
+ cryptopp_LIBRARY
+ cryptopp_INCLUDE_DIR)
+
+set (cryptopp_LIBRARIES ${cryptopp_LIBRARY})
+set (cryptopp_INCLUDE_DIRS ${cryptopp_INCLUDE_DIR})
+
+if (cryptopp_FOUND AND NOT (TARGET cryptopp::cryptopp))
+ add_library (cryptopp::cryptopp UNKNOWN IMPORTED)
+
+ set_target_properties (cryptopp::cryptopp
+ PROPERTIES
+ IMPORTED_LOCATION ${cryptopp_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${cryptopp_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/Finddpdk.cmake b/src/seastar/cmake/Finddpdk.cmake
new file mode 100644
index 000000000..c70b8e026
--- /dev/null
+++ b/src/seastar/cmake/Finddpdk.cmake
@@ -0,0 +1,493 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_path (dpdk_INCLUDE_DIR
+ NAMES rte_atomic.h
+ PATH_SUFFIXES dpdk)
+
+find_library (dpdk_PMD_VMXNET3_UIO_LIBRARY rte_pmd_vmxnet3_uio)
+find_library (dpdk_PMD_I40E_LIBRARY rte_pmd_i40e)
+find_library (dpdk_PMD_IXGBE_LIBRARY rte_pmd_ixgbe)
+find_library (dpdk_PMD_E1000_LIBRARY rte_pmd_e1000)
+find_library (dpdk_PMD_BNXT_LIBRARY rte_pmd_bnxt)
+find_library (dpdk_PMD_RING_LIBRARY rte_pmd_ring)
+find_library (dpdk_PMD_CXGBE_LIBRARY rte_pmd_cxgbe)
+find_library (dpdk_PMD_ENA_LIBRARY rte_pmd_ena)
+find_library (dpdk_PMD_ENIC_LIBRARY rte_pmd_enic)
+find_library (dpdk_PMD_FM10K_LIBRARY rte_pmd_fm10k)
+find_library (dpdk_PMD_NFP_LIBRARY rte_pmd_nfp)
+find_library (dpdk_PMD_QEDE_LIBRARY rte_pmd_qede)
+find_library (dpdk_RING_LIBRARY rte_ring)
+find_library (dpdk_KVARGS_LIBRARY rte_kvargs)
+find_library (dpdk_MEMPOOL_LIBRARY rte_mempool)
+find_library (dpdk_MEMPOOL_RING_LIBRARY rte_mempool_ring)
+find_library (dpdk_PMD_SFC_EFX_LIBRARY rte_pmd_sfc_efx)
+find_library (dpdk_HASH_LIBRARY rte_hash)
+find_library (dpdk_CMDLINE_LIBRARY rte_cmdline)
+find_library (dpdk_MBUF_LIBRARY rte_mbuf)
+find_library (dpdk_CFGFILE_LIBRARY rte_cfgfile)
+find_library (dpdk_EAL_LIBRARY rte_eal)
+find_library (dpdk_ETHDEV_LIBRARY rte_ethdev)
+find_library (dpdk_NET_LIBRARY rte_net)
+find_library (dpdk_TIMER_LIBRARY rte_timer)
+find_library (dpdk_PCI_LIBRARY rte_pci)
+find_library (dpdk_BUS_PCI_LIBRARY rte_bus_pci)
+find_library (dpdk_BUS_VDEV_LIBRARY rte_bus_vdev)
+
+include (FindPackageHandleStandardArgs)
+
+set (dpdk_REQUIRED
+ dpdk_INCLUDE_DIR
+ dpdk_PMD_VMXNET3_UIO_LIBRARY
+ dpdk_PMD_I40E_LIBRARY
+ dpdk_PMD_IXGBE_LIBRARY
+ dpdk_PMD_E1000_LIBRARY
+ dpdk_PMD_BNXT_LIBRARY
+ dpdk_PMD_RING_LIBRARY
+ dpdk_PMD_CXGBE_LIBRARY
+ dpdk_PMD_ENA_LIBRARY
+ dpdk_PMD_ENIC_LIBRARY
+ dpdk_PMD_NFP_LIBRARY
+ dpdk_PMD_QEDE_LIBRARY
+ dpdk_RING_LIBRARY
+ dpdk_KVARGS_LIBRARY
+ dpdk_MEMPOOL_LIBRARY
+ dpdk_MEMPOOL_RING_LIBRARY
+ dpdk_HASH_LIBRARY
+ dpdk_CMDLINE_LIBRARY
+ dpdk_MBUF_LIBRARY
+ dpdk_CFGFILE_LIBRARY
+ dpdk_EAL_LIBRARY
+ dpdk_ETHDEV_LIBRARY
+ dpdk_NET_LIBRARY
+ dpdk_TIMER_LIBRARY
+ dpdk_PCI_LIBRARY
+ dpdk_BUS_PCI_LIBRARY
+ dpdk_BUS_VDEV_LIBRARY)
+
+# fm10k, sfc_efx driver can only build on x86
+if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ set (dpdk_REQUIRED
+ ${dpdk_REQUIRED}
+ dpdk_PMD_FM10K_LIBRARY
+ dpdk_PMD_SFC_EFX_LIBRARY)
+endif()
+
+find_package_handle_standard_args (dpdk
+ REQUIRED_VARS
+ ${dpdk_REQUIRED}
+)
+
+if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk))
+ set (dpdk_LIBRARIES
+ ${dpdk_CFGFILE_LIBRARY}
+ ${dpdk_CMDLINE_LIBRARY}
+ ${dpdk_ETHDEV_LIBRARY}
+ ${dpdk_HASH_LIBRARY}
+ ${dpdk_MBUF_LIBRARY}
+ ${dpdk_EAL_LIBRARY}
+ ${dpdk_KVARGS_LIBRARY}
+ ${dpdk_MEMPOOL_LIBRARY}
+ ${dpdk_MEMPOOL_RING_LIBRARY}
+ ${dpdk_PMD_BNXT_LIBRARY}
+ ${dpdk_PMD_E1000_LIBRARY}
+ ${dpdk_PMD_ENA_LIBRARY}
+ ${dpdk_PMD_ENIC_LIBRARY}
+ ${dpdk_PMD_QEDE_LIBRARY}
+ ${dpdk_PMD_I40E_LIBRARY}
+ ${dpdk_PMD_IXGBE_LIBRARY}
+ ${dpdk_PMD_NFP_LIBRARY}
+ ${dpdk_PMD_RING_LIBRARY}
+ ${dpdk_PMD_VMXNET3_UIO_LIBRARY})
+
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ set (dpdk_LIBRARIES
+ ${dpdk_LIBRARIES}
+ ${dpdk_PMD_FM10K_LIBRARY}
+ ${dpdk_PMD_SFC_EFX_LIBRARY})
+ endif()
+
+ set (dpdk_LIBRARIES
+ ${dpdk_LIBRARIES}
+ ${dpdk_RING_LIBRARY}
+ ${dpdk_NET_LIBRARY}
+ ${dpdk_TIMER_LIBRARY}
+ ${dpdk_PCI_LIBRARY}
+ ${dpdk_BUS_PCI_LIBRARY}
+ ${dpdk_BUS_VDEV_LIBRARY})
+
+ #
+ # pmd_vmxnet3_uio
+ #
+
+ add_library (dpdk::pmd_vmxnet3_uio UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_vmxnet3_uio
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_VMXNET3_UIO_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_i40e
+ #
+
+ add_library (dpdk::pmd_i40e UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_i40e
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_I40E_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_ixgbe
+ #
+
+ add_library (dpdk::pmd_ixgbe UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_ixgbe
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_IXGBE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_e1000
+ #
+
+ add_library (dpdk::pmd_e1000 UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_e1000
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_E1000_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_bnxt
+ #
+
+ add_library (dpdk::pmd_bnxt UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_bnxt
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_BNXT_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_ring
+ #
+
+ add_library (dpdk::pmd_ring UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_ring
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_RING_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_cxgbe
+ #
+
+ add_library (dpdk::pmd_cxgbe UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_cxgbe
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_CXGBE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_ena
+ #
+
+ add_library (dpdk::pmd_ena UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_ena
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_ENA_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_enic
+ #
+
+ add_library (dpdk::pmd_enic UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_enic
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_ENIC_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_fm10k
+ #
+
+ add_library (dpdk::pmd_fm10k UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_fm10k
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_FM10K_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_nfp
+ #
+
+ add_library (dpdk::pmd_nfp UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_nfp
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_NFP_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_qede
+ #
+
+ add_library (dpdk::pmd_qede UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_qede
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_QEDE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pmd_sfc_efx
+ #
+
+ add_library (dpdk::pmd_sfc_efx UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pmd_sfc_efx
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PMD_SFC_EFX_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # hash
+ #
+
+ add_library (dpdk::hash UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::hash
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_HASH_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # kvargs
+ #
+
+ add_library (dpdk::kvargs UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::kvargs
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_KVARGS_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # mbuf
+ #
+
+ add_library (dpdk::mbuf UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::mbuf
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_MBUF_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}
+ INTERFACE_LINK_LIBRARIES dpdk::eal)
+
+ #
+ # eal (since dpdk 18.08, eal depends on kvargs)
+ #
+
+ add_library (dpdk::eal UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::eal
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_EAL_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}
+ INTERFACE_LINK_LIBRARIES dpdk::kvargs)
+
+ #
+ # ethdev
+ #
+
+ add_library (dpdk::ethdev UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::ethdev
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_ETHDEV_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}
+ INTERACE_LINK_LIBRARIES dpdk::eal)
+
+ #
+ # mempool
+ #
+
+ add_library (dpdk::mempool UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::mempool
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_MEMPOOL_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # mempool_ring
+ #
+
+ add_library (dpdk::mempool_ring UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::mempool_ring
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_MEMPOOL_RING_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # ring
+ #
+
+ add_library (dpdk::ring UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::ring
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_RING_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # cmdline
+ #
+
+ add_library (dpdk::cmdline UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::cmdline
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_CMDLINE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # cfgfile
+ #
+
+ add_library (dpdk::cfgfile UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::cfgfile
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_CFGFILE_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # net
+ #
+
+ add_library (dpdk::net UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::net
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_NET_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # timer
+ #
+
+ add_library (dpdk::timer UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::timer
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_TIMER_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # pci
+ #
+
+ add_library (dpdk::pci UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::pci
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_PCI_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # bus_pci
+ #
+
+ add_library (dpdk::bus_pci UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::bus_pci
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_BUS_PCI_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # bus_vdev
+ #
+
+ add_library (dpdk::bus_vdev UNKNOWN IMPORTED)
+
+ set_target_properties (dpdk::bus_vdev
+ PROPERTIES
+ IMPORTED_LOCATION ${dpdk_BUS_VDEV_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR})
+
+ #
+ # Summary.
+ #
+
+ add_library (dpdk::dpdk INTERFACE IMPORTED)
+
+ set (_dpdk_libraries
+ dpdk::cfgfile
+ dpdk::cmdline
+ dpdk::eal
+ dpdk::ethdev
+ dpdk::hash
+ dpdk::kvargs
+ dpdk::mbuf
+ dpdk::mempool
+ dpdk::mempool_ring
+ dpdk::pmd_bnxt
+ dpdk::pmd_cxgbe
+ dpdk::pmd_e1000
+ dpdk::pmd_ena
+ dpdk::pmd_enic
+ dpdk::pmd_qede
+ dpdk::pmd_i40e
+ dpdk::pmd_ixgbe
+ dpdk::pmd_nfp
+ dpdk::pmd_ring
+ dpdk::pmd_vmxnet3_uio
+ dpdk::ring
+ dpdk::net
+ dpdk::timer
+ dpdk::pci
+ dpdk::bus_pci
+ dpdk::bus_vdev)
+
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ set (_dpdk_libraries
+ ${_dpdk_libraries}
+ dpdk::pmd_fm10k
+ dpdk::pmd_sfc_efx)
+ endif()
+
+ set_target_properties (dpdk::dpdk
+ PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_dpdk_libraries}")
+endif ()
diff --git a/src/seastar/cmake/Findhwloc.cmake b/src/seastar/cmake/Findhwloc.cmake
new file mode 100644
index 000000000..e5a8ead24
--- /dev/null
+++ b/src/seastar/cmake/Findhwloc.cmake
@@ -0,0 +1,61 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_package (PkgConfig REQUIRED)
+
+pkg_search_module (hwloc_PC hwloc)
+
+find_library (hwloc_LIBRARY
+ NAMES hwloc
+ HINTS
+ ${hwloc_PC_LIBDIR}
+ ${hwloc_PC_LIBRARY_DIRS})
+
+find_path (hwloc_INCLUDE_DIR
+ NAMES hwloc.h
+ HINTS
+ ${hwloc_PC_INCLUDEDIR}
+ ${hwloc_PC_INCLUDEDIRS})
+
+mark_as_advanced (
+ hwloc_LIBRARY
+ hwloc_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (hwloc
+ REQUIRED_VARS
+ hwloc_LIBRARY
+ hwloc_INCLUDE_DIR
+ VERSION_VAR hwloc_PC_VERSION)
+
+set (hwloc_LIBRARIES ${hwloc_LIBRARY})
+set (hwloc_INCLUDE_DIRS ${hwloc_INCLUDE_DIR})
+
+if (hwloc_FOUND AND NOT (TARGET hwloc::hwloc))
+ add_library (hwloc::hwloc UNKNOWN IMPORTED)
+
+ set_target_properties (hwloc::hwloc
+ PROPERTIES
+ IMPORTED_LOCATION ${hwloc_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${hwloc_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/Findlksctp-tools.cmake b/src/seastar/cmake/Findlksctp-tools.cmake
new file mode 100644
index 000000000..c048edf60
--- /dev/null
+++ b/src/seastar/cmake/Findlksctp-tools.cmake
@@ -0,0 +1,54 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_library (lksctp-tools_LIBRARY
+ NAMES sctp)
+
+find_path (lksctp-tools_INCLUDE_DIR
+ NAMES netinet/sctp.h)
+
+mark_as_advanced (
+ lksctp-tools_LIBRARY
+ lksctp-tools_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (lksctp-tools
+ REQUIRED_VARS
+ lksctp-tools_LIBRARY
+ lksctp-tools_INCLUDE_DIR)
+
+set (lksctp-tools_LIBRARIES ${lksctp-tools_LIBRARY})
+set (lksctp-tools_INCLUDE_DIRS ${lksctp-tools_INCLUDE_DIR})
+
+if (lksctp-tools_FOUND AND NOT (TARGET lksctp-tools::lksctp-tools))
+ add_library (lksctp-tools::lksctp-tools UNKNOWN IMPORTED)
+
+ set_target_properties (lksctp-tools::lksctp-tools
+ PROPERTIES
+ IMPORTED_LOCATION ${lksctp-tools_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${lksctp-tools_INCLUDE_DIRS})
+endif ()
+
+mark_as_advanced (
+ lksctp-tools_INCLUDE_DIR
+ lksctp-tools_LIBRARY)
diff --git a/src/seastar/cmake/Findlz4.cmake b/src/seastar/cmake/Findlz4.cmake
new file mode 100644
index 000000000..e0c773540
--- /dev/null
+++ b/src/seastar/cmake/Findlz4.cmake
@@ -0,0 +1,70 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_package (PkgConfig REQUIRED)
+
+pkg_search_module (lz4_PC liblz4)
+
+find_library (lz4_LIBRARY
+ NAMES lz4
+ HINTS
+ ${lz4_PC_LIBDIR}
+ ${lz4_PC_LIBRARY_DIRS})
+
+find_path (lz4_INCLUDE_DIR
+ NAMES lz4.h
+ HINTS
+ ${lz4_PC_INCLUDEDIR}
+ ${lz4_PC_INCLUDEDIRS})
+
+mark_as_advanced (
+ lz4_LIBRARY
+ lz4_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (lz4
+ REQUIRED_VARS
+ lz4_LIBRARY
+ lz4_INCLUDE_DIR
+ VERSION_VAR lz4_PC_VERSION)
+
+set (lz4_LIBRARIES ${lz4_LIBRARY})
+set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
+
+if (lz4_FOUND)
+ set (CMAKE_REQUIRED_LIBRARIES ${lz4_LIBRARY})
+ include (CheckSymbolExists)
+
+ check_symbol_exists (LZ4_compress_default
+ ${lz4_INCLUDE_DIR}/lz4.h
+ lz4_HAVE_COMPRESS_DEFAULT)
+endif ()
+
+if (lz4_FOUND AND NOT (TARGET lz4::lz4))
+ add_library (lz4::lz4 UNKNOWN IMPORTED)
+
+ set_target_properties (lz4::lz4
+ PROPERTIES
+ IMPORTED_LOCATION ${lz4_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/Findnumactl.cmake b/src/seastar/cmake/Findnumactl.cmake
new file mode 100644
index 000000000..82f015274
--- /dev/null
+++ b/src/seastar/cmake/Findnumactl.cmake
@@ -0,0 +1,50 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_path (numactl_INCLUDE_DIR
+ NAMES numaif.h)
+
+find_library (numactl_LIBRARY
+ NAMES numa)
+
+mark_as_advanced (
+ numactl_INCLUDE_DIR
+ numactl_LIBRARY)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (numactl
+ REQUIRED_VARS
+ numactl_LIBRARY
+ numactl_INCLUDE_DIR)
+
+set (numactl_INCLUDE_DIRS ${numactl_INCLUDE_DIR})
+set (numactl_LIBRARIES ${numactl_LIBRARY})
+
+if (numactl_FOUND AND NOT (TARGET numactl::numactl))
+ add_library (numactl::numactl UNKNOWN IMPORTED)
+
+ set_target_properties (numactl::numactl
+ PROPERTIES
+ IMPORTED_LOCATION ${numactl_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${numactl_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/Findragel.cmake b/src/seastar/cmake/Findragel.cmake
new file mode 100644
index 000000000..7bea8735b
--- /dev/null
+++ b/src/seastar/cmake/Findragel.cmake
@@ -0,0 +1,45 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_program (
+ ragel_RAGEL_EXECUTABLE
+ ragel)
+
+mark_as_advanced (ragel_RAGEL_EXECUTABLE)
+
+set (_ragel_version_pattern "[0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+)?")
+
+if (ragel_RAGEL_EXECUTABLE)
+ set (ragel_FOUND ON)
+
+ exec_program (${ragel_RAGEL_EXECUTABLE}
+ ARGS -v
+ OUTPUT_VARIABLE _ragel_version_output)
+
+ if (${_ragel_version_output} MATCHES "version (${_ragel_version_pattern})")
+ set (ragel_VERSION ${CMAKE_MATCH_1})
+ endif ()
+endif ()
+
+find_package_handle_standard_args (ragel
+ REQUIRED_VARS ragel_RAGEL_EXECUTABLE
+ VERSION_VAR ragel_VERSION)
diff --git a/src/seastar/cmake/Findrt.cmake b/src/seastar/cmake/Findrt.cmake
new file mode 100644
index 000000000..359043c0e
--- /dev/null
+++ b/src/seastar/cmake/Findrt.cmake
@@ -0,0 +1,57 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+set (_rt_test_source ${CMAKE_CURRENT_LIST_DIR}/code_tests/rt_test.cc)
+
+# Try to compile without the library first.
+try_compile (rt_NO_EXPLICIT_LINK
+ ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${_rt_test_source})
+
+if (rt_NO_EXPLICIT_LINK)
+ set (rt_FOUND yes)
+else ()
+ # The `rt` library is required.
+
+ try_compile (_rt_test
+ ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${_rt_test_source}
+ LINK_LIBRARIES rt)
+
+ if (_rt_test)
+ set (rt_LIBRARY_NAME rt)
+ set (rt_LIBRARIES -l${rt_LIBRARY_NAME})
+ endif ()
+
+ include (FindPackageHandleStandardArgs)
+
+ find_package_handle_standard_args (rt
+ REQUIRED_VARS rt_LIBRARIES)
+endif ()
+
+if (rt_FOUND AND NOT (TARGET rt::rt))
+ add_library (rt::rt INTERFACE IMPORTED)
+
+ set_target_properties (rt::rt
+ PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${rt_LIBRARIES}")
+endif ()
diff --git a/src/seastar/cmake/Findyaml-cpp.cmake b/src/seastar/cmake/Findyaml-cpp.cmake
new file mode 100644
index 000000000..d1e135737
--- /dev/null
+++ b/src/seastar/cmake/Findyaml-cpp.cmake
@@ -0,0 +1,62 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+find_package (PkgConfig REQUIRED)
+
+pkg_search_module (yaml-cpp_PC yaml-cpp)
+
+find_library (yaml-cpp_LIBRARY
+ NAMES yaml-cpp
+ HINTS
+ ${yaml-cpp_PC_LIBDIR}
+ ${yaml-cpp_PC_LIBRARY_DIRS})
+
+find_path (yaml-cpp_INCLUDE_DIR
+ NAMES yaml-cpp/yaml.h
+ PATH_SUFFIXES yaml-cpp
+ HINTS
+ ${yaml-cpp_PC_INCLUDEDIR}
+ ${yaml-cpp_PC_INCLUDE_DIRS})
+
+mark_as_advanced (
+ yaml-cpp_LIBRARY
+ yaml-cpp_INCLUDE_DIR)
+
+include (FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args (yaml-cpp
+ REQUIRED_VARS
+ yaml-cpp_LIBRARY
+ yaml-cpp_INCLUDE_DIR
+ VERSION_VAR yaml-cpp_PC_VERSION)
+
+set (yaml-cpp_LIBRARIES ${yaml-cpp_LIBRARY})
+set (yaml-cpp_INCLUDE_DIRS ${yaml-cpp_INCLUDE_DIR})
+
+if (yaml-cpp_FOUND AND NOT (TARGET yaml-cpp::yaml-cpp))
+ add_library (yaml-cpp::yaml-cpp UNKNOWN IMPORTED)
+
+ set_target_properties (yaml-cpp::yaml-cpp
+ PROPERTIES
+ IMPORTED_LOCATION ${yaml-cpp_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIRS})
+endif ()
diff --git a/src/seastar/cmake/SeastarConfig.cmake.in b/src/seastar/cmake/SeastarConfig.cmake.in
new file mode 100644
index 000000000..9fc8bd3de
--- /dev/null
+++ b/src/seastar/cmake/SeastarConfig.cmake.in
@@ -0,0 +1,37 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+# We would like to use `find_dependency`, but it is not supported properly until CMake 3.8.
+#include (FindDependencyMacro)
+
+list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+#
+# Dependencies.
+#
+
+include (SeastarDependencies)
+seastar_find_dependencies ()
+
+if (NOT TARGET Seastar::seastar)
+ include ("${CMAKE_CURRENT_LIST_DIR}/SeastarTargets.cmake")
+endif ()
diff --git a/src/seastar/cmake/SeastarDependencies.cmake b/src/seastar/cmake/SeastarDependencies.cmake
new file mode 100644
index 000000000..ca841352c
--- /dev/null
+++ b/src/seastar/cmake/SeastarDependencies.cmake
@@ -0,0 +1,100 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2019 Scylladb, Ltd.
+#
+
+#
+# CMake bundles `FindBoost.cmake`, which is coupled to the Boost version. If
+# we're on a system without a recent enough version of `FindBoost.cmake`, then
+# we need to use the one bundled with Seastar.
+#
+# The "real" FIND_PACKAGE invocation for Boost is inside SEASTAR_FIND_DEPENDENCIES.
+#
+
+# Be consistent in results from FindBoost.cmake.
+# This is required because cmake-boost may return to Boost_{component}_LIBRARY:
+# - /usr/lib64/libboost_foo.so
+# - Boost::foo
+set (Boost_NO_BOOST_CMAKE ON)
+
+# This is the minimum version of Boost we need the CMake-bundled `FindBoost.cmake` to know about.
+find_package (Boost 1.64 MODULE)
+
+#
+# Iterate through the dependency list defined below and execute `find_package`
+# with the corresponding configuration for each 3rd-party dependency.
+#
+macro (seastar_find_dependencies)
+ #
+ # List of Seastar dependencies that is meant to be used
+ # both in Seastar configuration and by clients which
+ # consume Seastar via SeastarConfig.cmake.
+ #
+ set (_seastar_all_dependencies
+ # Public dependencies.
+ Boost
+ c-ares
+ cryptopp
+ dpdk # No version information published.
+ fmt
+ lz4
+ # Private and private/public dependencies.
+ Concepts
+ GnuTLS
+ LinuxMembarrier
+ Protobuf
+ Sanitizers
+ StdAtomic
+ hwloc
+ lksctp-tools # No version information published.
+ numactl # No version information published.
+ rt
+ yaml-cpp)
+
+ # Arguments to `find_package` for each 3rd-party dependency.
+ # Note that the version specification is a "minimal" version requirement.
+
+ # `unit_test_framework` is not required in the case we are building Seastar
+ # without the testing library, however the component is always specified as required
+ # to keep the CMake code minimalistic and easy-to-use.
+ set (_seastar_dep_args_Boost
+ 1.64.0
+ COMPONENTS
+ program_options
+ thread
+ unit_test_framework
+ REQUIRED)
+
+ set (_seastar_dep_args_c-ares 1.13 REQUIRED)
+ set (_seastar_dep_args_cryptopp 5.6.5 REQUIRED)
+ set (_seastar_dep_args_fmt 5.0.0 REQUIRED)
+ set (_seastar_dep_args_lz4 1.7.3 REQUIRED)
+ set (_seastar_dep_args_GnuTLS 3.3.26 REQUIRED)
+ set (_seastar_dep_args_Protobuf 2.5.0 REQUIRED)
+ set (_seastar_dep_args_StdAtomic REQUIRED)
+ set (_seastar_dep_args_hwloc 1.11.2)
+ set (_seastar_dep_args_lksctp-tools REQUIRED)
+ set (_seastar_dep_args_rt REQUIRED)
+ set (_seastar_dep_args_yaml-cpp 0.5.1 REQUIRED)
+
+ foreach (third_party ${_seastar_all_dependencies})
+ find_package ("${third_party}" ${_seastar_dep_args_${third_party}})
+ endforeach ()
+endmacro ()
diff --git a/src/seastar/cmake/code_tests/Concepts_test.cc b/src/seastar/cmake/code_tests/Concepts_test.cc
new file mode 100644
index 000000000..4644393aa
--- /dev/null
+++ b/src/seastar/cmake/code_tests/Concepts_test.cc
@@ -0,0 +1,3 @@
+#if __cpp_concepts == 201507
+int main() { return 0; }
+#endif
diff --git a/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc b/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc
new file mode 100644
index 000000000..7cb1fdfb0
--- /dev/null
+++ b/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc
@@ -0,0 +1,8 @@
+extern "C" {
+#include <linux/membarrier.h>
+}
+
+int main() {
+ int x = MEMBARRIER_CMD_PRIVATE_EXPEDITED | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED;
+ (void)x;
+}
diff --git a/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc b/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc
new file mode 100644
index 000000000..9df531f26
--- /dev/null
+++ b/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc
@@ -0,0 +1,11 @@
+#include <cstddef>
+
+extern "C" {
+ void __sanitizer_start_switch_fiber(void**, const void*, size_t);
+ void __sanitizer_finish_switch_fiber(void*, const void**, size_t*);
+}
+
+int main() {
+ __sanitizer_start_switch_fiber(nullptr, nullptr, 0);
+ __sanitizer_finish_switch_fiber(nullptr, nullptr, nullptr);
+}
diff --git a/src/seastar/cmake/code_tests/rt_test.cc b/src/seastar/cmake/code_tests/rt_test.cc
new file mode 100644
index 000000000..c0bf83e32
--- /dev/null
+++ b/src/seastar/cmake/code_tests/rt_test.cc
@@ -0,0 +1,10 @@
+extern "C" {
+#include <signal.h>
+#include <time.h>
+}
+
+int main() {
+ timer_t td;
+ struct sigevent sev;
+ timer_create(CLOCK_MONOTONIC, &sev, &td);
+}
diff --git a/src/seastar/cmake/dpdk_configure.cmake b/src/seastar/cmake/dpdk_configure.cmake
new file mode 100644
index 000000000..46b9bb759
--- /dev/null
+++ b/src/seastar/cmake/dpdk_configure.cmake
@@ -0,0 +1,41 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. You may not use this file except in compliance with the License.
+#
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+file (READ ${Seastar_DPDK_CONFIG_FILE_IN} dpdk_config)
+file (STRINGS ${Seastar_DPDK_CONFIG_FILE_CHANGES} dpdk_config_changes)
+set (word_pattern "[^\n\r \t]+")
+
+foreach (var ${dpdk_config_changes})
+ if (var MATCHES "(${word_pattern})=(${word_pattern})")
+ set (key ${CMAKE_MATCH_1})
+ set (value ${CMAKE_MATCH_2})
+
+ string (REGEX REPLACE
+ "${key}=${word_pattern}"
+ "${key}=${value}"
+ dpdk_config
+ ${dpdk_config})
+ endif ()
+endforeach ()
+
+file (WRITE ${Seastar_DPDK_CONFIG_FILE_OUT} ${dpdk_config})
+file (APPEND ${Seastar_DPDK_CONFIG_FILE_OUT} "CONFIG_RTE_MACHINE=${Seastar_DPDK_MACHINE}")