cmake: add support for transitive ZLIB target#3123
cmake: add support for transitive ZLIB target#3123skirk wants to merge 3 commits intocurl:masterfrom
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. |
|
|
||
| if("@USE_OPENSSL@") | ||
| if("@USE_OPENSSL@" OR "@CURL_ZLIB@" ) | ||
| include(CMakeFindDependencyMacro) |
There was a problem hiding this comment.
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()
| find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@") | ||
| if ("@USE_OPENSSL@") | ||
| find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@") | ||
| endif() |
There was a problem hiding this comment.
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: |
|
Thanks! |
Create transitive CMake targets for ZLIB similarly to OpenSSL. The changes follow the convention as in #3055.