lsalzman / enet

ENet reliable UDP networking library
MIT License
2.66k stars 667 forks source link

CMake: Enable shared builds #242

Closed Croydon closed 3 months ago

Croydon commented 3 months ago

Currently, the CMake file hard-configured a static build of enet. These are the minimal changes required to enable shared builds of enet as well.

CMake has the default BUILD_SHARED_LIBS option to determinate if a shared or static build is desired.

For builds that

Why only for MSVC and Clang? Because enet then makes use of __declspec here: https://github.com/lsalzman/enet/blob/276ff5ae05a245bcee195af9c9fd002851517d40/include/enet/win32.h#L40 And this is only available with MSVC and with Clang when compiling for Windows.