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

fix_zstd_libraries_cmake #554

Merged
merged 2 commits into from
Feb 16, 2021
Merged

Conversation

prateek9623
Copy link
Contributor

Fixes zstd linking with find_package

set(ZSTD_VERSION ${ZSTD_VERSION_STRING})
if(ZSTD_FOUND)
set(ZSTD_VERSION ${ZSTD_VERSION_STRING})
if(TARGET libzstd_static)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this should be:

if(NOT DEFINED BUILD_SHARED_LIBS OR NOT ${BUILD_SHARED_LIBS})

Like on line 379.

Copy link
Contributor Author

@prateek9623 prateek9623 Feb 11, 2021

Choose a reason for hiding this comment

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

because there is not always the case that we would get shared libs, for e.g. if vcpkg is used to link zstd in Linux, then build would fail, because vcpkg don't support shared in linux

set(ZSTD_VERSION ${ZSTD_VERSION_STRING})
if(ZSTD_FOUND)
set(ZSTD_VERSION ${ZSTD_VERSION_STRING})
if(TARGET libzstd_static)
Copy link
Member

Choose a reason for hiding this comment

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

Why not do:

set(ZSTD_LIBRARIES libzstd_static)

Then we can use:

list(APPEND MINIZIP_LIB ${ZSTD_LIBRARIES})

down below in if(ZSTD_FOUND AND NOT MZ_FORCE_FETCH_LIBS) like before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i can simplify this a bit, i just added this because I thought it would be pointless to add

                    set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lzstd")
                    list(APPEND MINIZIP_DEP_PKG ZSTD)

if we are linking statically, but after further thinking, it would fail if minizip is itself is static

@prateek9623 prateek9623 marked this pull request as ready for review February 12, 2021 09:26
@nmoinvaz nmoinvaz merged commit 1352bb5 into zlib-ng:dev Feb 16, 2021
@nmoinvaz
Copy link
Member

Thanks!

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.

2 participants