[cpr] Enable dynamic builds via CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS

This commit is contained in:
Robert Schumacher 2017-06-20 15:36:35 -07:00
parent 7b5093984f
commit d026905ae9
3 changed files with 26 additions and 35 deletions

View File

@ -0,0 +1,17 @@
diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index a6db5bd..b4982d1 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -45,3 +45,12 @@ add_library(${CPR_LIBRARIES}
message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.")
target_link_libraries(${CPR_LIBRARIES}
${CURL_LIBRARIES})
+
+install(TARGETS ${CPR_LIBRARIES}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(DIRECTORY ${CPR_INCLUDE_DIRS} DESTINATION include)
+endif()

View File

@ -1,13 +0,0 @@
diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index a6db5bd..9df92a6 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -3,7 +3,7 @@ include_directories(
${CPR_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS})
-add_library(${CPR_LIBRARIES}
+add_library(${CPR_LIBRARIES} STATIC
# Source files
auth.cpp

View File

@ -1,15 +1,3 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions) include(vcpkg_common_functions)
vcpkg_from_github( vcpkg_from_github(
@ -21,24 +9,23 @@ vcpkg_from_github(
vcpkg_apply_patches( vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/force_static_library.patch PATCHES ${CMAKE_CURRENT_LIST_DIR}/enable-install.patch
) )
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja PREFER_NINJA
OPTIONS OPTIONS
-DBUILD_CPR_TESTS=OFF -DBUILD_CPR_TESTS=OFF
-DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_CURL=ON
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
) )
vcpkg_build_cmake() vcpkg_install_cmake()
file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}) vcpkg_copy_pdbs()
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/cpr.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cpr/CMakeFiles/cpr.dir/cpr.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/cpr.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/cpr/CMakeFiles/cpr.dir/cpr.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
# Handle copyright # Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpr) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpr)