Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Enable shared builds #242

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

Croydon
Copy link
Contributor

@Croydon Croydon commented Apr 18, 2024

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

  • are shared
  • and target Windows
  • and are either compiled with MSVC or Clang

the following two definitions are declared:

Why only for MSVC and Clang? Because enet then makes use of __declspec here:

#ifdef ENET_DLL

And this is only available with MSVC and with Clang when compiling for Windows.


@lsalzman lsalzman merged commit ca56fec into lsalzman:master Apr 18, 2024
6 checks passed
@Croydon Croydon deleted the cmake_enable_shared_builds branch April 19, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add shared library link option?
2 participants