pineapple-src/externals/vcpkg/ports/azure-iot-sdk-c/improve-external-deps-preview.patch

113 lines
3.9 KiB
Diff
Raw Normal View History

2022-07-23 03:01:36 +02:00
diff --git a/configs/azure_iot_sdksConfig.cmake b/configs/azure_iot_sdksConfig.cmake
index b9c62e8..edf5847 100644
--- a/configs/azure_iot_sdksConfig.cmake
+++ b/configs/azure_iot_sdksConfig.cmake
@@ -1,5 +1,11 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
+include(CMakeFindDependencyMacro)
+find_dependency(unofficial-parson)
+find_dependency(uamqp)
+find_dependency(uhttp)
+find_dependency(umqtt)
+find_dependency(azure_c_shared_utility)
include("${CMAKE_CURRENT_LIST_DIR}/azure_iot_sdksTargets.cmake")
diff --git a/iothub_client/tests/iothubclient_amqp_dt_e2e/CMakeLists.txt b/iothub_client/tests/iothubclient_amqp_dt_e2e/CMakeLists.txt
index 33b5b8709..45ef7b87a 100644
--- a/iothub_client/tests/iothubclient_amqp_dt_e2e/CMakeLists.txt
+++ b/iothub_client/tests/iothubclient_amqp_dt_e2e/CMakeLists.txt
@@ -31,12 +31,10 @@ set(${theseTestsName}_c_files
set(${theseTestsName}_c_files
../../../certs/certs.c
- ../../../deps/parson/parson.c
)
set(${theseTestsName}_h_files
../../../certs/certs.h
- ../../../deps/parson/parson.h
../common_dt_e2e/iothubclient_common_dt_e2e.h
)
diff --git a/iothub_client/tests/iothubclient_mqtt_dt_e2e_sfc/CMakeLists.txt b/iothub_client/tests/iothubclient_mqtt_dt_e2e_sfc/CMakeLists.txt
index d05d654..5872c8d 100644
--- a/iothub_client/tests/iothubclient_mqtt_dt_e2e_sfc/CMakeLists.txt
+++ b/iothub_client/tests/iothubclient_mqtt_dt_e2e_sfc/CMakeLists.txt
@@ -31,12 +31,10 @@ set(${theseTestsName}_nuget_c_files
set(${theseTestsName}_c_files
../../../certs/certs.c
- ../../../deps/parson/parson.c
)
set(${theseTestsName}_h_files
../../../certs/certs.h
- ../../../deps/parson/parson.h
../common_dt_e2e/iothubclient_common_dt_e2e.h
)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba2f8e016..19885c8b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,17 +179,6 @@ endif()
# Use solution folders.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-# build the parson library for json parsing
-add_library(parson
- ./deps/parson/parson.c
- ./deps/parson/parson.h
-)
-if (MSVC)
- set_source_files_properties(../deps/parson/parson.c PROPERTIES COMPILE_FLAGS "/wd4244 /wd4232")
-endif()
-set(parson_h_install_files ./deps/parson/parson.h)
-set(parson_install_libs parson)
-
if (IN_OPENWRT)
ADD_DEFINITIONS("$ENV{TARGET_LDFLAGS}" "$ENV{TARGET_CPPFLAGS}" "$ENV{TARGET_CFLAGS}")
INCLUDE_DIRECTORIES("$ENV{TOOLCHAIN_DIR}/usr/include" "$ENV{TARGET_LDFLAGS}" "$ENV{TARGET_CPPFLAGS}" "$ENV{TARGET_CFLAGS}")
@@ -407,7 +396,7 @@ endif()
if (${use_installed_dependencies})
# Install azure_iot_sdks
- set(package_location "cmake")
+ set(package_location "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
include(CMakePackageConfigHelpers)
@@ -422,14 +411,10 @@ if (${use_installed_dependencies})
COPYONLY
)
- install(FILES ${parson_h_install_files}
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
- )
- install(TARGETS ${parson_install_libs} EXPORT azure_iot_sdksTargets
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
- )
+ find_package(unofficial-parson REQUIRED CONFIG)
+ if(NOT TARGET parson)
+ add_library(parson ALIAS unofficial::parson::parson)
+ endif()
install(EXPORT azure_iot_sdksTargets
FILE
@@ -446,11 +431,5 @@ if (${use_installed_dependencies})
DESTINATION
${package_location}
)
-else()
- install(FILES ${parson_h_install_files}
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot)
- install(TARGETS ${parson_install_libs}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()