forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Source: curlpp | ||
Version: 2018-06-15 | ||
Description: C++ wrapper around libcURL | ||
Build-Depends: curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 8b183a0..a801ae8 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -85,11 +85,12 @@ endif() | ||
|
||
file(GLOB_RECURSE HeaderFileList "${CMAKE_CURRENT_SOURCE_DIR}/include/*") | ||
file(GLOB_RECURSE SourceFileList "${CMAKE_CURRENT_SOURCE_DIR}/src/*") | ||
+if(BUILD_SHARED_LIBS) | ||
add_library(${PROJECT_NAME} SHARED ${HeaderFileList} ${SourceFileList}) | ||
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES} ${CONAN_LIBS}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1 VERSION 1.0.0) | ||
- | ||
-add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList}) | ||
+else() | ||
+add_library(${PROJECT_NAME} STATIC ${HeaderFileList} ${SourceFileList}) | ||
|
||
# Make sure that on unix-platforms shared and static libraries have | ||
# the same root name, but different suffixes. | ||
@@ -97,19 +98,28 @@ add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList}) | ||
# (solution taken from https://cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F) | ||
# | ||
# Making shared and static libraries have the same root name, but different suffixes | ||
-SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) | ||
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) | ||
# Now the library target "curlpp_static" will be named "curlpp.lib" with MS tools. | ||
# This conflicts with the "curlpp.lib" import library corresponding to "curlpp.dll", | ||
# so we add a "lib" prefix (which is default on other platforms anyway): | ||
-SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES PREFIX "lib") | ||
-target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES} ${CONAN_LIBS}) | ||
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "lib") | ||
+target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES} ${CONAN_LIBS}) | ||
+endif() | ||
+ | ||
+target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>) | ||
|
||
# install headers | ||
install(DIRECTORY include/utilspp/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/utilspp") | ||
install(DIRECTORY include/curlpp/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/curlpp") | ||
|
||
-install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_static | ||
+install(TARGETS ${PROJECT_NAME} | ||
+ EXPORT ${PROJECT_NAME}-config | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
+install(EXPORT ${PROJECT_NAME}-config | ||
+ FILE unofficial-${PROJECT_NAME}-config.cmake | ||
+ NAMESPACE unofficial::${PROJECT_NAME}:: | ||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
+) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
include(vcpkg_common_functions) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO jpbarrette/curlpp | ||
REF 8810334c830faa3b38bcd94f5b1ab695a4f05eb9 | ||
SHA512 47eb0738d7cd2d4262c455f9472a21535343bcf08bda6de19771dab9204e068272b41782c87057d50e3781683a29e79d6387577be68d175a7fa890367f15d0d2 | ||
HEAD_REF master | ||
PATCHES | ||
fix-cmake.patch | ||
) | ||
|
||
vcpkg_configure_cmake( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PREFER_NINJA | ||
) | ||
|
||
vcpkg_install_cmake() | ||
|
||
vcpkg_fixup_cmake_targets( | ||
CONFIG_PATH lib/cmake/${PORT} | ||
TARGET_PATH share/unofficial-${PORT} | ||
) | ||
|
||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static) | ||
file(REMOVE_RECURSE | ||
${CURRENT_PACKAGES_DIR}/bin | ||
${CURRENT_PACKAGES_DIR}/debug/bin | ||
) | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake | ||
${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT} | ||
@ONLY | ||
) | ||
endif() | ||
|
||
# Handle copyright | ||
configure_file(${SOURCE_PATH}/doc/LICENSE | ||
${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) | ||
|
||
vcpkg_copy_pdbs() | ||
|
||
# CMake integration test | ||
#vcpkg_test_cmake(PACKAGE_NAME ${PORT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
_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() |