Fix vcpkg install for the vendored uamqp (#5095)
* Fix vcpkg install for the vendored uamqp * Make changes mergeable to upstream * Update CMakeLists.txt * Update CMakeLists.txt --------- Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
parent
df8f9ddf1a
commit
c9329cb34b
@ -35,11 +35,13 @@ if (VENDOR_UAMQP)
|
||||
message(STATUS "Using vendored uamqp")
|
||||
set(use_installed_dependencies ON CACHE BOOL "Use vcpkg dependencies." FORCE)
|
||||
set(skip_samples ON CACHE BOOL "Skip building samples" FORCE)
|
||||
set(build_as_object_library ON CACHE BOOL "Produce object library" FORCE)
|
||||
|
||||
add_subdirectory(vendor/azure-uamqp-c SYSTEM)
|
||||
|
||||
# uAMQP specific compiler settings. Primarily used to disable warnings in the uAMQP codebase.
|
||||
if (MSVC)
|
||||
target_compile_definitions(uamqp PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(uamqp PUBLIC -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments -Wno-cast-qual -Wno-format-pedantic)
|
||||
else()
|
||||
@ -126,10 +128,9 @@ set(AZURE_CORE_AMQP_SOURCE
|
||||
src/private/package_version.hpp
|
||||
)
|
||||
|
||||
add_library(azure-core-amqp ${AZURE_CORE_AMQP_SOURCE} ${AZURE_CORE_AMQP_HEADER})
|
||||
add_library(azure-core-amqp ${AZURE_CORE_AMQP_SOURCE} ${AZURE_CORE_AMQP_HEADER} $<TARGET_OBJECTS:uamqp>)
|
||||
|
||||
if (VENDOR_UAMQP)
|
||||
target_compile_definitions(azure-core-amqp PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_include_directories(azure-core-amqp SYSTEM PRIVATE ${UAMQP_INC_FOLDER})
|
||||
endif()
|
||||
|
||||
@ -151,7 +152,6 @@ create_code_coverage(core azure-core-amqp-uamqp azure-core-amqp-uamqp-tests "tes
|
||||
# cspell:words aziotsharedutil
|
||||
# uAMQP's headers require the manual addition of umock_c, azure_macro_utils_c, and aziotsharedutil to the target link libraries.
|
||||
target_link_libraries(azure-core-amqp PRIVATE
|
||||
uamqp
|
||||
umock_c
|
||||
azure_macro_utils_c
|
||||
aziotsharedutil
|
||||
|
||||
@ -14,7 +14,7 @@ urlFragment: azure-core-amqp
|
||||
These code samples show common scenario operations for the Azure SDK for C++ AMQP support.
|
||||
|
||||
The AMQP client library is a C++ library for communicating with entities that use the AMQP
|
||||
protocol. It is a wrapper around the [Azure uAMQP Library](https://github.com/Azure/azure-uamqp-c/).
|
||||
protocol.
|
||||
|
||||
These samples are intended to demonstrate common AMQP use scenarios for Azure Service authors and are
|
||||
not intended to be a comprehensive collection of all possible uses for the library. The samples are
|
||||
|
||||
@ -12,6 +12,7 @@ option(skip_samples "set skip_samples to ON to skip building samples (default is
|
||||
option(use_installed_dependencies "set use_installed_dependencies to ON to use installed packages instead of building dependencies from submodules" OFF)
|
||||
option(memory_trace "set memory_trace to ON if memory usage is to be used, set to OFF to not use it" OFF)
|
||||
option(use_custom_heap "use externally defined heap functions instead of the malloc family" OFF)
|
||||
option(build_as_object_library "produce cmake object library and skip install steps" OFF)
|
||||
|
||||
if(${use_custom_heap})
|
||||
add_definitions(-DGB_USE_CUSTOM_HEAP)
|
||||
@ -238,11 +239,19 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(uamqp
|
||||
${uamqp_c_files}
|
||||
${uamqp_h_files}
|
||||
${socketlistener_c_files}
|
||||
)
|
||||
if (build_as_object_library)
|
||||
add_library(uamqp OBJECT
|
||||
${uamqp_c_files}
|
||||
${uamqp_h_files}
|
||||
${socketlistener_c_files}
|
||||
)
|
||||
else()
|
||||
add_library(uamqp
|
||||
${uamqp_c_files}
|
||||
${uamqp_h_files}
|
||||
${socketlistener_c_files}
|
||||
)
|
||||
endif()
|
||||
setTargetBuildProperties(uamqp)
|
||||
|
||||
target_link_libraries(uamqp aziotsharedutil)
|
||||
@ -260,50 +269,52 @@ endif()
|
||||
set(UAMQP_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "This is the include folder for UAMQP" FORCE)
|
||||
set(UAMQP_SRC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/src CACHE INTERNAL "This is the lib folder for UAMQP" FORCE)
|
||||
|
||||
# Set CMAKE_INSTALL_LIBDIR if not defined
|
||||
include(GNUInstallDirs)
|
||||
if (NOT build_as_object_library)
|
||||
# Set CMAKE_INSTALL_LIBDIR if not defined
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Install uamqp
|
||||
set(package_location "cmake")
|
||||
# Install uamqp
|
||||
set(package_location "cmake")
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(CMAKE_INSTALL_LIBDIR "lib")
|
||||
endif()
|
||||
|
||||
install(TARGETS uamqp EXPORT uamqpTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/../bin
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
|
||||
)
|
||||
install(FILES ${uamqp_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot/azure_uamqp_c)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${UAMQP_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
configure_file("configs/${PROJECT_NAME}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
install(EXPORT uamqpTargets
|
||||
FILE
|
||||
"${PROJECT_NAME}Targets.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"configs/${PROJECT_NAME}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS uamqp EXPORT uamqpTargets
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/../bin
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
|
||||
)
|
||||
install(FILES ${uamqp_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot/azure_uamqp_c)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${UAMQP_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
configure_file("configs/${PROJECT_NAME}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
install(EXPORT uamqpTargets
|
||||
FILE
|
||||
"${PROJECT_NAME}Targets.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"configs/${PROJECT_NAME}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION
|
||||
${package_location}
|
||||
)
|
||||
|
||||
compileTargetAsC99(uamqp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user