Skip to content

Commit 6712dfe

Browse files
committed
Fix incorrect include when building against.
Wrong winsock header was included on targets linking to gamespy.
1 parent 112ee06 commit 6712dfe

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.14...4.0)
22

33
# Use packagename_ROOT for FindPackage.
44
if(POLICY CMP0074)

include/gamespy/gsplatform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363

6464
// WIN32
6565
#elif defined(_WIN32)
66+
#ifndef WIN32_LEAN_AND_MEAN
6667
#define WIN32_LEAN_AND_MEAN
68+
#endif
6769
#include <windows.h>
6870
#include <limits.h>
6971
#include <time.h>

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ if(BUILD_SHARED_LIBS)
7979
set_target_properties(gamespy PROPERTIES ARCHIVE_OUTPUT_NAME gamespy_import WINDOWS_EXPORT_ALL_SYMBOLS ON)
8080
endif()
8181

82+
# Handle including sockets library headers for consumers.
83+
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
84+
if(GS_WINSOCK2)
85+
target_compile_definitions(gamespy INTERFACE GSI_WINSOCK2)
86+
endif()
87+
endif()
88+
8289
if(GS_BUILD_TESTS)
8390
add_executable(chattest chat/chatc/chatc.c)
8491
target_link_libraries(chattest gamespy)

0 commit comments

Comments
 (0)