From 418abc8323d92727cecd9989a00f75ca51e140b2 Mon Sep 17 00:00:00 2001 From: Stephen Berry Date: Tue, 25 Jun 2024 10:55:05 -0500 Subject: [PATCH] Adding libfork dependency --- include/glaze/network/server.hpp | 5 +++++ tests/socket_test/CMakeLists.txt | 11 ++++++++++- tests/socket_test/socket_test.cpp | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/glaze/network/server.hpp b/include/glaze/network/server.hpp index 4a0574960e..3740c52dbf 100644 --- a/include/glaze/network/server.hpp +++ b/include/glaze/network/server.hpp @@ -5,6 +5,11 @@ #include "glaze/network/socket.hpp" +#if __has_include() +#else +static_assert("libfork is required for using glaze network code. The library must be included by the developer."); +#endif + #ifdef _WIN32 #define GLZ_CLOSE_SOCKET closesocket #define GLZ_EVENT_CLOSE WSACloseEvent diff --git a/tests/socket_test/CMakeLists.txt b/tests/socket_test/CMakeLists.txt index 8685725812..b7cf8d62a4 100644 --- a/tests/socket_test/CMakeLists.txt +++ b/tests/socket_test/CMakeLists.txt @@ -1,8 +1,17 @@ project(socket_test) +FetchContent_Declare( + libfork + GIT_REPOSITORY https://github.com/conorwilliams/libfork.git + GIT_TAG v3.8.0 + GIT_SHALLOW TRUE +) + +FetchContent_MakeAvailable(libfork) + add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE glz_test_common) +target_link_libraries(${PROJECT_NAME} PRIVATE glz_test_common libfork::libfork) add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) diff --git a/tests/socket_test/socket_test.cpp b/tests/socket_test/socket_test.cpp index 11e7ae405c..cc44e1b02e 100644 --- a/tests/socket_test/socket_test.cpp +++ b/tests/socket_test/socket_test.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "ut/ut.hpp"