Skip to content

Commit

Permalink
use cmake VERIFY_INTERFACE_HEADER_SETS
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Aug 7, 2022
1 parent 5f1e7ff commit e52efbb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 7 deletions.
13 changes: 10 additions & 3 deletions asio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14...3.23)
cmake_minimum_required(VERSION 3.23...3.24)

include(cmake/prelude.cmake)

Expand All @@ -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 "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" #
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
Expand Down
4 changes: 3 additions & 1 deletion asio/cmake/install-rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions asio/include/asio/spawn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include "asio/detail/config.hpp"

#if defined(HAVE_BOOST) || defined(GENERATING_DOCUMENTATION)
#include <boost/coroutine/all.hpp>
#include "asio/any_io_executor.hpp"
#include "asio/cancellation_signal.hpp"
#include "asio/cancellation_state.hpp"
Expand Down Expand Up @@ -901,4 +904,6 @@ void spawn(ExecutionContext& ctx,

#include "asio/impl/spawn.hpp"

#endif // defined(HAVE_BOOST) || defined(GENERATING_DOCUMENTATION)

#endif // ASIO_SPAWN_HPP
2 changes: 2 additions & 0 deletions asio/include/asio/ssl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
1 change: 1 addition & 0 deletions asio/src/examples/cpp11/timeouts/async_tcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "asio/read_until.hpp"
#include "asio/steady_timer.hpp"
#include "asio/write.hpp"
#include <chrono>
#include <functional>
#include <iostream>
#include <string>
Expand Down
7 changes: 4 additions & 3 deletions asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "asio/read_until.hpp"
#include "asio/system_error.hpp"
#include "asio/write.hpp"
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <string>
Expand Down Expand Up @@ -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])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "asio/streambuf.hpp"
#include "asio/system_error.hpp"
#include "asio/write.hpp"
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "asio/buffer.hpp"
#include "asio/io_context.hpp"
#include "asio/ip/udp.hpp"
#include <chrono>
#include <cstdlib>
#include <functional>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions asio/src/examples/cpp11/timeouts/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

#include <algorithm>
#include <chrono>
#include <cstdlib>
#include <deque>
#include <iostream>
Expand Down

0 comments on commit e52efbb

Please sign in to comment.