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

Don't forbid shared library builds #93

Open
bretbrownjr opened this issue Jan 27, 2025 · 1 comment
Open

Don't forbid shared library builds #93

bretbrownjr opened this issue Jan 27, 2025 · 1 comment

Comments

@bretbrownjr
Copy link
Contributor

Problem

Beman libraries currently hardcode STATIC in their add_library calls. This is:

  • Practically not needed
  • Limits the ability to build the projects as shard libraries, which standard C++ libraries do support
  • Breaks support for the standard CMake feature to controlling how to choose between static or shared builds: BUILD_SHARED_LIBS

Proposal

In [CMAKE.LIBRARY_NAME], change this:

add_library(beman.smart_pointer STATIC)

To this:

add_library(beman.smart_pointer)

Further, require the latter style with justification as outlined in the "Problem" section of this issue.

Reference

For add_library supporting BUILD_SHARED_LIBS:
https://cmake.org/cmake/help/latest/command/add_library.html

Docs for BUILD_SHARED_LIBS, including that STATIC is the default for CMake built libraries.
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html#variable:BUILD_SHARED_LIBS

A PR to the Beman Exemplar to apply the relevant one-line change:
See bemanproject/exemplar#104.

@bretbrownjr
Copy link
Contributor Author

Note that we could test different settings for BUILD_SHARED_LIBS, though I do get concerned about the combinatorial explosion of all the possible combinations of tests, both in terms of compute per commit pushed but also in terms of the amount of complexity in the GitHub actions configuration.

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

No branches or pull requests

1 participant