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

Avoid building both a shared and static library #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JohannesKauffmann
Copy link
Collaborator

There is no reason to unconditionally build both variants. It increases
compile times, and consumers already know whether or not they want a
static or shared artifact. Instead, use a standard CMake construct to
build either one of them.

To allow users to override static vs shared for EIPScanner only, use a
new variable called EIPScanner_SHARED_LIBS: If set, our add_library()
will create a shared library, if not, a static library is created.
Building a static library by default also matches the default behaviour
of add_library().

This still allows users to specify BUILD_SHARED_LIBS on the command line
as an ultimate override, but at the same time avoids having
BUILD_SHARED_LIBS be the only option for building static vs shared.

There is no reason to unconditionally build both variants. It increases
compile times, and consumers already know whether or not they want a
static or shared artifact. Instead, use a standard CMake construct to
build either one of them.

To allow users to override static vs shared for EIPScanner only, use a
new variable called EIPScanner_SHARED_LIBS: If set, our add_library()
will create a shared library, if not, a static library is created.
Building a static library by default also matches the default behaviour
of add_library().

This still allows users to specify BUILD_SHARED_LIBS on the command line
as an ultimate override, but at the same time avoids having
BUILD_SHARED_LIBS be the only option for building static vs shared.
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.

1 participant