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

CMakeLists.txt: don't force the build of a shared library #39

Merged
merged 1 commit into from
Sep 11, 2017

Conversation

tpetazzoni
Copy link
Contributor

Building a shared library doesn't work on all platforms, so instead,
let CMake rely on the standard BUILD_SHARED_LIBS variable to decide
whether a static or shared library should be built.

Signed-off-by: Thomas Petazzoni thomas.petazzoni@free-electrons.com

Building a shared library doesn't work on all platforms, so instead,
let CMake rely on the standard BUILD_SHARED_LIBS variable to decide
whether a static or shared library should be built.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
EXPORT ${PROJECT_NAME}-targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is that related to the BUILD_SHARED_LIBS variable change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If BUILD_SHARED_LIBS is off, a static library is built, and cmake uses the "ARCHIVE DESTINATION" to know where to install it, while the "LIBRARY DESTINATION" is used when a shared library is built.

@LeSpocky LeSpocky self-assigned this Sep 3, 2017
@LeSpocky LeSpocky added the build label Sep 3, 2017
@LeSpocky LeSpocky added this to the v1.2 milestone Sep 3, 2017
@LeSpocky
Copy link
Collaborator

If I would add an option in CMakeLists.txt to set BUILD_SHARED_LIBS to ON by default, this would still allow to let buildroot or any other build system or user to set it to OFF, right? Then I could take this PR, add this option in another commit and keep the previous behaviour.

LeSpocky added a commit to LeSpocky/libcgi that referenced this pull request Sep 11, 2017
PR rafaelsteil#39 changed the behaviour to support building a shared or static
library based on the global CMake variable BUILD_SHARED_LIBS, but the
build system had to set it from outside. Now it's an option and the user
can easily set it in the CMake GUI, while setting from outside is of
course still possible. Additionally this allows us to change the default
from building a static library to building a shared library like it was
before PR rafaelsteil#39.
@LeSpocky LeSpocky mentioned this pull request Sep 11, 2017
@LeSpocky LeSpocky merged commit 58edd50 into rafaelsteil:master Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants