Skip to content

Adding optional configuration for building as a shared library vs static? #51

Description

I needed to build a shared library version of GDeflate to satisfy a dependency, but currently the CMake configuration only builds a static version. I was able to fix this by replacing

add_library(GDeflate STATIC ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS})

with

if(BUILD_SHARED_LIBS)
    add_library(GDeflate SHARED ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS})
else()
    add_library(GDeflate STATIC ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS})
endif()

I also had to change this in 3rdparty/libdeflate.cmake, ending up with two shared libraries. It's a small change but I wanted to propose a PR for it in case it would be useful for anyone else? Let me know what you think.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions