Navigation Menu

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

cmake configuration fails with custom provided zlib #5512

malytomas opened this issue Jun 3, 2020 · 2 comments

cmake configuration fails with custom provided zlib #5512

malytomas opened this issue Jun 3, 2020 · 2 comments


Copy link

I am using curl with add_subdirectory in cmake. I have custom zlib (zlib-ng actually), and I provide target ZLIB::ZLIB as an interface library, which has dependency on another target. The target ZLIB::ZLIB does not have (and cannot have) the property LOCATION.

Unfortunately, recent changes to curl cmake:

get_target_property(_lib "${_lib}" LOCATION)

generates this error in my setup:

-- Enabled features: SSL IPv6 libz AsynchDNS SSPI SPNEGO Kerberos NTLM
-- Enabled protocols: HTTP HTTPS
-- Enabled SSL backends: WinSSL
CMake Error at externals/curl/curl/CMakeLists.txt:1416 (get_target_property):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "LOCATION" is not allowed.

CMake Warning at externals/curl/curl/CMakeLists.txt:1418 (message):
  Bad lib in library list: ZLIB::ZLIB

The code does not seem to have any effect and commenting it worked for me.

  #if(TARGET "${_lib}")
  #  set(_libname "${_lib}")
  #  get_target_property(_lib "${_lib}" LOCATION)
  #  if(NOT _lib)
  #    message(WARNING "Bad lib in library list: ${_libname}")
  #    continue()
  #  endif()
  if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-")
    set(LIBCURL_LIBS          "${LIBCURL_LIBS} ${_lib}")
    set(LIBCURL_LIBS          "${LIBCURL_LIBS} -l${_lib}")

curl/libcurl version

commit 2bf7d1b

operating system

Windows 10
cmake version 3.17.3
(msvc 16.6.1)

@bagder bagder added the cmake label Jun 3, 2020
Copy link

The code was added via a158a09 to avoid adding stuff like OpenSSL::SSL to the generated pkg-config (.pc) file. For a configuration such as yours, I guess it is better to omit the library from the .pc file and assume the integrator adds the appropriate linking commands.

Can you test the upcoming patch?

Copy link

Yes this is working for me. Thanks.

@bagder bagder closed this as completed in 26d2755 Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging a pull request may close this issue.

3 participants