From 766073f1715f8ea5775b9ccbe244b60a3c425e0d Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 7 Aug 2022 00:12:51 +0200 Subject: [PATCH] use cmake VERIFY_INTERFACE_HEADER_SETS --- asio/CMakeLists.txt | 13 ++++++++++--- asio/cmake/install-rules.cmake | 4 +++- asio/include/asio/spawn.hpp | 4 ++++ asio/include/asio/ssl.hpp | 2 ++ .../examples/cpp11/timeouts/async_tcp_client.cpp | 1 + .../examples/cpp11/timeouts/blocking_tcp_client.cpp | 7 ++++--- .../cpp11/timeouts/blocking_token_tcp_client.cpp | 1 + .../examples/cpp11/timeouts/blocking_udp_client.cpp | 1 + asio/src/examples/cpp11/timeouts/server.cpp | 1 + 9 files changed, 27 insertions(+), 7 deletions(-) diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt index 63037735e6..80571563cc 100644 --- a/asio/CMakeLists.txt +++ b/asio/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14...3.23) +cmake_minimum_required(VERSION 3.23...3.24) include(cmake/prelude.cmake) @@ -14,14 +14,21 @@ include(cmake/variables.cmake) if(PROJECT_IS_TOP_LEVEL) include(GNUInstallDirs) # for CMAKE_INSTALL_INCLUDEDIR + set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON) endif() # ---- Declare library ---- -add_library(asio INTERFACE) +file(GLOB headers "include/asio/*.hpp") +file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") + +add_library(asio INTERFACE ${implementation}) add_library(asio::asio ALIAS asio) + +target_sources(asio INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${headers}) + target_include_directories( - asio SYSTEM # XXX ${warning_guard} + asio # NO! SYSTEM # XXX ${warning_guard} INTERFACE "$" # "$" ) diff --git a/asio/cmake/install-rules.cmake b/asio/cmake/install-rules.cmake index a4912d3f4b..018f7853e1 100644 --- a/asio/cmake/install-rules.cmake +++ b/asio/cmake/install-rules.cmake @@ -13,7 +13,9 @@ set(package asio) install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) -install(TARGETS asio EXPORT asioTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(TARGETS asio EXPORT asioTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILE_SET HEADERS +) write_basic_package_version_file("${package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) diff --git a/asio/include/asio/spawn.hpp b/asio/include/asio/spawn.hpp index fb91c22d7f..023ae96d0d 100644 --- a/asio/include/asio/spawn.hpp +++ b/asio/include/asio/spawn.hpp @@ -16,6 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" + +#if defined(HAVE_BOOST) || defined(GENERATING_DOCUMENTATION) #include #include "asio/any_io_executor.hpp" #include "asio/bind_executor.hpp" @@ -342,4 +344,6 @@ void spawn(ExecutionContext& ctx, #include "asio/impl/spawn.hpp" +#endif + #endif // ASIO_SPAWN_HPP diff --git a/asio/include/asio/ssl.hpp b/asio/include/asio/ssl.hpp index c3c51aa8d7..a5c634ab6a 100644 --- a/asio/include/asio/ssl.hpp +++ b/asio/include/asio/ssl.hpp @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#ifdef HAVE_OPENSSL #include "asio/ssl/context.hpp" #include "asio/ssl/context_base.hpp" #include "asio/ssl/error.hpp" @@ -24,5 +25,6 @@ #include "asio/ssl/stream_base.hpp" #include "asio/ssl/verify_context.hpp" #include "asio/ssl/verify_mode.hpp" +#endif #endif // ASIO_SSL_HPP diff --git a/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp index f0aa15ea8a..05a4b52cfd 100644 --- a/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp @@ -14,6 +14,7 @@ #include "asio/read_until.hpp" #include "asio/steady_timer.hpp" #include "asio/write.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp index 4721e4c8ae..3fb4d4b6e7 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp @@ -15,6 +15,7 @@ #include "asio/read_until.hpp" #include "asio/system_error.hpp" #include "asio/write.hpp" +#include #include #include #include @@ -160,15 +161,15 @@ int main(int argc, char* argv[]) } client c; - c.connect(argv[1], argv[2], std::chrono::seconds(10)); + c.connect(argv[1], argv[2], std::chrono::milliseconds(10)); auto time_sent = std::chrono::steady_clock::now(); - c.write_line(argv[3], std::chrono::seconds(10)); + c.write_line(argv[3], std::chrono::milliseconds(10)); for (;;) { - std::string line = c.read_line(std::chrono::seconds(10)); + std::string line = c.read_line(std::chrono::milliseconds(10)); // Keep going until we get back the line that was sent. if (line == argv[3]) diff --git a/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp index d9c38a6cb1..3f3f620e1b 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp @@ -15,6 +15,7 @@ #include "asio/streambuf.hpp" #include "asio/system_error.hpp" #include "asio/write.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp index 9352b64e02..4553aa444e 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp @@ -11,6 +11,7 @@ #include "asio/buffer.hpp" #include "asio/io_context.hpp" #include "asio/ip/udp.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/server.cpp b/asio/src/examples/cpp11/timeouts/server.cpp index 68655550d7..38b8918675 100644 --- a/asio/src/examples/cpp11/timeouts/server.cpp +++ b/asio/src/examples/cpp11/timeouts/server.cpp @@ -9,6 +9,7 @@ // #include +#include #include #include #include