forked from Azure/azure-blob-storage-file-upload-utility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (53 loc) · 2.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required (VERSION 3.5)
project(azure_blob_storage_file_upload_utility)
set (library_name azure_blob_storage_file_upload_utility)
set (CMAKE_C_STANDARD 99)
set (CMAKE_CXX_STANDARD 14)
find_package (azure_c_shared_utility REQUIRED)
find_package(CURL REQUIRED)
find_package(azure-storage-blobs-cpp CONFIG REQUIRED)
if ( CMAKE_VERSION VERSION_LESS 3.13)
find_package(CURL REQUIRED)
if (NOT TARGET CURL::libcurl)
if(CURL_INCLUDE_DIR)
foreach(_curl_version_header curlver.h curl.h)
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
unset(curl_version_str)
break()
endif()
endforeach()
endif()
add_library(CURL::libcurl UNKNOWN IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
if(EXISTS "${CURL_LIBRARY}")
set_target_properties(CURL::libcurl PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${CURL_LIBRARY}")
endif()
set_property(TARGET CURL::libcurl APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(CURL::libcurl PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}")
endif()
endif()
include_directories(${CURL_INCLUDE_DIRS})
set(${library_name}_target_libs ${azure_blob_storage_file_upload_utility_target_libs} ${CURL_LIBRARIES})
add_library (${library_name} STATIC src/azure_blob_storage_file_upload_utility.cpp src/blob_storage_helper.hpp
src/blob_storage_helper.cpp)
target_include_directories (${library_name} PUBLIC inc)
target_link_libraries (
${library_name}
PUBLIC aziotsharedutil
PRIVATE Azure::azure-storage-blobs Azure::azure-core ${azure_blob_storage_file_upload_utility_target_libs})
set(AZURE_BLOB_STORAGE_UTILITY_VERSION_MAJOR 0)
set(AZURE_BLOB_STORAGE_UTILITY_VERSION_MINOR 1)
set(AZURE_BLOB_STORAGE_UTILITY_VERSION_REVISION 0)
install(DIRECTORY inc/ DESTINATION include)
install(TARGETS ${library_name}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)