-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
cmake: add support for transitive ZLIB target #3123
Conversation
This still also needs accompanying changes to CMake/curl-config.cmake.in. I will add that to the PR later today. |
I would like to fix the appveyor build, but I fail to understand what's the issue from the logs. Any ideas? |
I think the appveyor failure is just a flaky test and not your fault. I'll retrigger the build. |
@skirk Could you please elaborate more what issue you've tried to solve? |
Hi @snikulov, In my use case, I want to link ZLIB statically. Currently the default implementation of FindZlib favours The transitive target gives more control to the library user to control whether to link statically or shared without relying on clumsy hacks. Also in terms of future proofing if usage requirements of ZLIB for some reason change, they will be transitioned with the target to the client app rather than being decomposed to _LIBS and _INCLUDE_DIRS variables which might strip some of those requirements. |
CMake/curl-config.cmake.in
Outdated
@@ -1,9 +1,15 @@ | |||
@PACKAGE_INIT@ | |||
|
|||
if("@USE_OPENSSL@") | |||
if("@USE_OPENSSL@" OR "@CURL_ZLIB@" ) | |||
include(CMakeFindDependencyMacro) |
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.
I believe somebody will add another dependency shortly.
So why not include CMakeFindDependencyMacro unconditionally?
include(CMakeFindDependencyMacro)
if("@USE_OPENSSL@")
find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@")
endif()
if("@USE_ZLIB@")
find_dependency(ZLIB "@ZLIB_VERSION_MAJOR@")
endif()
CMake/curl-config.cmake.in
Outdated
find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@") | ||
if ("@USE_OPENSSL@") | ||
find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@") | ||
endif() |
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.
AFAIR, indentation used in curl project is 2 spaces. Could you please fix? Looks like it has lurked from the previous review.
The commit above implements the requested changes. I also noticed the HAVE_ZLIB variable wasn't used anywhere so I changed it to USE_ZLIB to be consistent with the USE_OPENSSL. Also removed the unnecessary quotes from the @variables so the results after configure_file is: |
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.
LGTM
Thanks! |
Create transitive CMake targets for ZLIB similarly to OpenSSL. The changes follow the convention as in #3055.