fix curlpp and dynamic builds on linux

This commit is contained in:
Curtis.Bezault 2019-09-25 14:22:46 -07:00
parent c38954227e
commit 7358190c3b
4 changed files with 22 additions and 37 deletions

View File

@ -175,6 +175,16 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
else()
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/curl-config ${CURRENT_PACKAGES_DIR}/debug/bin/curl-config)
file(GLOB FILES LIST_DIRECTORIES TRUE ${CURRENT_PACKAGES_DIR}/bin/*)
if (FILES STREQUAL "")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
endif()
file(GLOB FILES LIST_DIRECTORIES TRUE ${CURRENT_PACKAGES_DIR}/debug/bin/*)
if (FILES STREQUAL "")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
endif()
file(READ ${CURRENT_PACKAGES_DIR}/include/curl/curl.h CURL_H)

View File

@ -23,11 +23,17 @@ if(TARGET CURL::libcurl)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
get_target_property(_curl_location_debug CURL::libcurl IMPORTED_IMPLIB_DEBUG)
get_target_property(_curl_location_release CURL::libcurl IMPORTED_IMPLIB_RELEASE)
else()
endif()
if(NOT _curl_location_debug AND NOT _curl_location_release)
get_target_property(_curl_location_debug CURL::libcurl IMPORTED_LOCATION_DEBUG)
get_target_property(_curl_location_release CURL::libcurl IMPORTED_LOCATION_RELEASE)
endif()
if(NOT _curl_link_libraries)
set(_curl_link_libraries)
endif()
set(CURL_INCLUDE_DIRS "${_curl_include_dirs}")
set(CURL_LIBRARY_DEBUG "${_curl_location_debug}")
set(CURL_LIBRARY_RELEASE "${_curl_location_release}")
@ -38,4 +44,9 @@ if(TARGET CURL::libcurl)
set(CURL_LIBRARIES ${CURL_LIBRARY} ${_curl_link_libraries})
set(CURL_VERSION_STRING "${CURL_VERSION}")
set(_curl_include_dirs)
set(_curl_link_libraries)
set(_curl_location_debug)
set(_curl_location_release)
endif()

View File

@ -31,7 +31,6 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}
@ONLY
)

View File

@ -1,35 +0,0 @@
_find_package(${ARGS})
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(TARGET unofficial::curlpp::curlpp)
# Fix CURL dependencies. See:
# https://github.com/Microsoft/vcpkg/issues/4312
set(_libs "")
find_package(CURL REQUIRED)
set(ZLIB_ROOT ${CMAKE_PREFIX_PATH}) # Prefer Zlib installed via `vcpkg`
find_package(ZLIB)
unset(ZLIB_ROOT)
list(APPEND _libs ${CURL_LIBRARIES} ZLIB::ZLIB)
find_package(OpenSSL QUIET)
if(OPENSSL_FOUND)
list(APPEND _libs OpenSSL::SSL OpenSSL::Crypto)
endif()
find_package(Threads REQUIRED)
list(APPEND _libs Threads::Threads)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND _libs Ws2_32 Crypt32)
endif()
set_target_properties(
unofficial::curlpp::curlpp
PROPERTIES INTERFACE_LINK_LIBRARIES "${_libs}"
)
endif()
endif()