From ca56fecaf35f6031b30d1573b8e772d7c81abcb4 Mon Sep 17 00:00:00 2001 From: Michael Keck Date: Thu, 18 Apr 2024 21:52:47 +0200 Subject: [PATCH] CMake: Enable shared builds (#242) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f225fbc..61cef93e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,12 @@ set(SOURCE_FILES source_group(include FILES ${INCLUDE_FILES}) source_group(source FILES ${SOURCE_FILES}) -add_library(enet STATIC +if(WIN32 AND BUILD_SHARED_LIBS AND (MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + add_definitions(-DENET_DLL=1) + add_definitions(-DENET_BUILDING_LIB) +endif() + +add_library(enet ${INCLUDE_FILES} ${SOURCE_FILES} )