summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-02-22 03:41:05 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-09 19:57:10 +0200
commitbb5c4e81c5648c509acaef9df8a6a988a6474858 (patch)
treeba74e121b974b5c491f2e115d4fb768827ba6163
parente6024a2e020ce28f87a785522b99212f91ed3ce4 (diff)
downloadqtlocation-mapboxgl-bb5c4e81c5648c509acaef9df8a6a988a6474858.tar.gz
[build] Make curl for Android a vendor package
This will make it easier to add it as dependencies of different targets.
-rw-r--r--platform/android/android.cmake12
-rw-r--r--vendor/curl.cmake17
2 files changed, 21 insertions, 8 deletions
diff --git a/platform/android/android.cmake b/platform/android/android.cmake
index 1fbe67836d..167f29c005 100644
--- a/platform/android/android.cmake
+++ b/platform/android/android.cmake
@@ -348,20 +348,16 @@ if(ANDROID_NATIVE_API_LEVEL VERSION_LESS 24)
PRIVATE ${PROJECT_SOURCE_DIR}/platform/android/src/test/http_file_source_test_stub.cpp
)
else()
- set(CURL_DIR ${PROJECT_SOURCE_DIR}/vendor/curl-android-ios/prebuilt-with-ssl/android)
- set(CURL_LIBRARY ${CURL_DIR}/${ANDROID_ABI}/libcurl.a)
-
target_sources(
mbgl-test-runner
PRIVATE ${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/storage/http_file_source.cpp
)
- target_include_directories(
- mbgl-test-runner
- PRIVATE ${CURL_DIR}/include
- )
+
+ include(${PROJECT_SOURCE_DIR}/vendor/curl.cmake)
+
target_link_libraries(
mbgl-test-runner
- PRIVATE ${CURL_LIBRARY}
+ PRIVATE mbgl-vendor-curl
)
endif()
diff --git a/vendor/curl.cmake b/vendor/curl.cmake
new file mode 100644
index 0000000000..fde112b9ec
--- /dev/null
+++ b/vendor/curl.cmake
@@ -0,0 +1,17 @@
+if(TARGET mbgl-vendor-curl)
+ return()
+endif()
+
+add_library(
+ mbgl-vendor-curl INTERFACE
+)
+
+target_link_libraries(
+ mbgl-vendor-curl
+ INTERFACE $<$<PLATFORM_ID:Android>:${CMAKE_CURRENT_LIST_DIR}/curl-android-ios/prebuilt-with-ssl/android/${ANDROID_ABI}/libcurl.a>
+)
+
+target_include_directories(
+ mbgl-vendor-curl SYSTEM
+ INTERFACE ${CMAKE_CURRENT_LIST_DIR}/curl-android-ios/curl/include
+)