This pull request, together with the merged changes of #241 and #187, also makes #147 obsolete. Closing #147.
Visual Studio has official, first-class support for CMake projects. Therefore allowing easily shared enet builds with VS when these changes are applied (together with the previously merged #241). Fixing #106.
Edit: Oops, I used wrong keywords. closing vs closes and fixing vs fixes.... will add it to my next pull request again.
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
and are either compiled with MSVC or Clang
the following two definitions are declared:
ENET_DLL
(see documentation)ENET_BUILDING_LIB
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.closing
vscloses
andfixing
vsfixes
.... will add it to my next pull request again.