vcpkg/ports/cpr/001-cpr-config.patch

95 lines
2.5 KiB
Diff
Raw Normal View History

diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt
index a6db5bd..90bec48 100644
--- a/cpr/CMakeLists.txt
+++ b/cpr/CMakeLists.txt
@@ -1,47 +1,46 @@
-message(STATUS "Using CURL_INCLUDE_DIRS: ${CURL_INCLUDE_DIRS}.")
-include_directories(
- ${CPR_INCLUDE_DIRS}
- ${CURL_INCLUDE_DIRS})
-
add_library(${CPR_LIBRARIES}
+ auth.cpp
+ cookies.cpp
+ cprtypes.cpp
+ digest.cpp
+ error.cpp
+ multipart.cpp
+ parameters.cpp
+ payload.cpp
+ proxies.cpp
+ session.cpp
+ timeout.cpp
+ util.cpp
+ ssl_options.cpp
+)
+
+target_link_libraries( ${CPR_LIBRARIES}
+ PUBLIC ${CURL_LIBRARIES}
+)
+
+target_include_directories(${CPR_LIBRARIES}
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ $<BUILD_INTERFACE:${CURL_INCLUDE_DIRS}>
+)
+
- # Source files
- auth.cpp
- cookies.cpp
- cprtypes.cpp
- digest.cpp
- error.cpp
- multipart.cpp
- parameters.cpp
- payload.cpp
- proxies.cpp
- session.cpp
- timeout.cpp
- util.cpp
- ssl_options.cpp
+set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
+install(
+ TARGETS ${CPR_LIBRARIES}
+ EXPORT ${TARGETS_EXPORT_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
- # Header files (useful in IDEs)
- "${CPR_INCLUDE_DIRS}/cpr/api.h"
- "${CPR_INCLUDE_DIRS}/cpr/auth.h"
- "${CPR_INCLUDE_DIRS}/cpr/body.h"
- "${CPR_INCLUDE_DIRS}/cpr/cookies.h"
- "${CPR_INCLUDE_DIRS}/cpr/cpr.h"
- "${CPR_INCLUDE_DIRS}/cpr/cprtypes.h"
- "${CPR_INCLUDE_DIRS}/cpr/curlholder.h"
- "${CPR_INCLUDE_DIRS}/cpr/defines.h"
- "${CPR_INCLUDE_DIRS}/cpr/digest.h"
- "${CPR_INCLUDE_DIRS}/cpr/error.h"
- "${CPR_INCLUDE_DIRS}/cpr/max_redirects.h"
- "${CPR_INCLUDE_DIRS}/cpr/multipart.h"
- "${CPR_INCLUDE_DIRS}/cpr/parameters.h"
- "${CPR_INCLUDE_DIRS}/cpr/payload.h"
- "${CPR_INCLUDE_DIRS}/cpr/proxies.h"
- "${CPR_INCLUDE_DIRS}/cpr/response.h"
- "${CPR_INCLUDE_DIRS}/cpr/session.h"
- "${CPR_INCLUDE_DIRS}/cpr/timeout.h"
- "${CPR_INCLUDE_DIRS}/cpr/util.h"
- "${CPR_INCLUDE_DIRS}/cpr/ssl_options.h")
+install(
+ EXPORT ${TARGETS_EXPORT_NAME}
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
+)
-message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.")
-target_link_libraries(${CPR_LIBRARIES}
- ${CURL_LIBRARIES})
+if (NOT DISABLE_INSTALL_HEADERS)
+ install(DIRECTORY ${CPR_INCLUDE_DIRS}/cpr DESTINATION include)
+endif()