Skip to content

Fix static build issues and allow user to choose which library do they want#18

Open
makise-homura wants to merge 3 commits intomartijnberger:masterfrom
makise-homura:fix-static-build
Open

Fix static build issues and allow user to choose which library do they want#18
makise-homura wants to merge 3 commits intomartijnberger:masterfrom
makise-homura:fix-static-build

Conversation

@makise-homura
Copy link
Copy Markdown

CMake does have a global BUILD_SHARED_LIBS variable which affects how add_library() works. E.g., when BUILD_SHARED_LIBS=ON (as it is usually on Windows, where you often link with shared Qt), there was no way to build clew statically, even if BUILD_SHARED_LIBRARY is set to OFF (which should lead to building a static library, according to documentation).

So, I did a fix that makes clew build like that:

  • If either BUILD_SHARED_LIBRARY or BUILD_STATIC_LIBRARY is set to ON, this overrides global BUILD_SHARED_LIBS and allows clew to be built either shared or static, regardless of BUILD_SHARED_LIBS;
  • If both are set to OFF (this is now the default), BUILD_SHARED_LIBS is used to determine which type of library does user want;
  • Library can be built either static or shared, setting both BUILD_SHARED_LIBRARY and BUILD_STATIC_LIBRARY to ON is treated as error.

And also I removed this annoying "exported" message while building a shared library on WIN32, otherwise it really does not look like a warningless build.

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