-
Notifications
You must be signed in to change notification settings - Fork 99
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
cpp: support linking statically on Windows #1229
base: main
Are you sure you want to change the base?
Conversation
A few thoughts after a quick review:
What is an alternative approach that does not mean introducing CMAKE specific un-documented defines to this library? |
I guess this could be solved in However, Regarding documentation, I'm happy to add this to the PR if you point me to the location where it should go (comment in the |
I think this is fine so long as this additional flag is explained in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will merge after readme is updated.
@wrightsg ping on updating the readme and then we can merge |
The |
Changelog
Allows building and linking the
mcap
library statically on Windows.Docs
None
Description
I'm using
mcap_builder
to use themcap
library in my project.Even though
mcap
is a header-only library,mcap_builder
creates a library for the client application to link against.mcap_builder
currently always creates a shared library. I have a PR open to support creating a static library: olympus-robotics/mcap_builder#4Creating and linking against a static library on Windows causes linking issues because
visibility.hpp
implicitly assumes dynamic linking.This PR adds a define that needs to be set when building the library statically. The PR is backwards compatible, i.e. the behavior remains the same as before if the define is not set. The define is named based on CMake convention, see https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html