From 099d311371829bed65ea1e89b4b5ffcb54b7cdac Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Sat, 9 Aug 2025 23:53:28 +0100 Subject: [PATCH] Fix incorrect include when building against. Wrong winsock header was included on targets linking to gamespy. --- include/gamespy/gsplatform.h | 2 ++ src/CMakeLists.txt | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/gamespy/gsplatform.h b/include/gamespy/gsplatform.h index 04e76a8..1be0f04 100644 --- a/include/gamespy/gsplatform.h +++ b/include/gamespy/gsplatform.h @@ -63,7 +63,9 @@ // WIN32 #elif defined(_WIN32) +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5e876c1..fff0b30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,6 +79,13 @@ if(BUILD_SHARED_LIBS) set_target_properties(gamespy PROPERTIES ARCHIVE_OUTPUT_NAME gamespy_import WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() +# Handle including sockets library headers for consumers. +if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") + if(GS_WINSOCK2) + target_compile_definitions(gamespy INTERFACE GSI_WINSOCK2) + endif() +endif() + if(GS_BUILD_TESTS) add_executable(chattest chat/chatc/chatc.c) target_link_libraries(chattest gamespy)