lsalzman / enet

ENet reliable UDP networking library
MIT License
2.78k stars 675 forks source link

CMake: Fix linking for Windows builds with non-MinGW compilers #241

Closed Croydon closed 7 months ago

Croydon commented 7 months ago

There are many open pull requests that have this change already included, but via #174 @lsalzman wishes for atomic pull requests.

So this pull request applies a minimal change to have CMake outputting functional Windows builds, while compiling with compilers other than MinGW.

Windows builds of enet always need to get linked to winmm and ws2_32.

if(WIN32) is true when the target platform is Windows, so this works for cross-compiling and native compiling with any compiler.