early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,26 @@
diff --git a/configs/azure_iot_build_rules.cmake b/configs/azure_iot_build_rules.cmake
index be3e14fe..aa402902 100644
--- a/configs/azure_iot_build_rules.cmake
+++ b/configs/azure_iot_build_rules.cmake
@@ -71,8 +71,6 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
elseif(UNIX) #LINUX OR APPLE
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
if(NOT (IN_OPENWRT OR APPLE))
set (CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L ${CMAKE_C_FLAGS}")
endif()
@@ -191,12 +189,6 @@ endfunction()
IF((WIN32) AND (NOT(MINGW)))
#windows needs this define
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
- # Make warning as error
- add_definitions(/WX)
-ELSE()
- # Make warning as error
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
ENDIF()

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25bbf383..31ca2da2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -678,7 +678,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
-set(package_location "cmake")
+set(package_location "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
if(${build_as_dynamic})
set(targets aziotsharedutil aziotsharedutil_dll)

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index deeaae7d..c0c84275 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -689,7 +689,7 @@ install (TARGETS ${targets} EXPORT aziotsharedutilTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
)
-install (FILES ${source_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azure_c_shared_utility)
+install (FILES ${source_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot/azure_c_shared_utility)
install (FILES ${micromock_h_files_full_path} ${INSTALL_H_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot)

View File

@@ -0,0 +1,248 @@
diff --git a/configs/azure_c_shared_utilityFunctions.cmake b/configs/azure_c_shared_utilityFunctions.cmake
index e85defa..7f450ab 100644
--- a/configs/azure_c_shared_utilityFunctions.cmake
+++ b/configs/azure_c_shared_utilityFunctions.cmake
@@ -2,11 +2,11 @@
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
function(target_link_libraries_with_arg_prefix arg_prefix whatIsBuilding lib)
- if(${arg_prefix} STREQUAL "debug")
+ if(arg_prefix STREQUAL "debug")
target_link_libraries(${whatIsBuilding} debug ${lib})
- elseif(${arg_prefix} STREQUAL "optimized")
+ elseif(arg_prefix STREQUAL "optimized")
target_link_libraries(${whatIsBuilding} optimized ${lib})
- elseif(${arg_prefix} STREQUAL "general")
+ elseif(arg_prefix STREQUAL "general")
target_link_libraries(${whatIsBuilding} general ${lib})
else()
target_link_libraries(${whatIsBuilding} ${lib})
@@ -43,13 +43,13 @@ function(windows_unittests_add_dll whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -57,7 +57,7 @@ function(windows_unittests_add_dll whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f})
@@ -90,13 +90,13 @@ function(windows_unittests_add_exe whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -104,7 +104,7 @@ function(windows_unittests_add_exe whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -150,14 +150,14 @@ function(linux_unittests_add_exe whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
set(skip_to_next TRUE)
#also unset all the other states
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -165,7 +165,7 @@ function(linux_unittests_add_exe whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -184,7 +184,7 @@ function(linux_unittests_add_exe whatIsBuilding)
if(${run_valgrind})
find_program(VALGRIND_FOUND NAMES valgrind)
- if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
+ if(VALGRIND_FOUND STREQUAL VALGRIND_FOUND-NOTFOUND)
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
else()
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
@@ -307,13 +307,13 @@ function(c_windows_unittests_add_dll whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -321,7 +321,7 @@ function(c_windows_unittests_add_dll whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f})
@@ -369,13 +369,13 @@ function(c_windows_unittests_add_exe whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -383,7 +383,7 @@ function(c_windows_unittests_add_exe whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -429,13 +429,13 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -443,7 +443,7 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -462,7 +462,7 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
if(${run_valgrind})
find_program(VALGRIND_FOUND NAMES valgrind)
- if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
+ if(VALGRIND_FOUND STREQUAL VALGRIND_FOUND-NOTFOUND)
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
else()
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
@@ -546,29 +546,29 @@ function(compile_c_test_artifacts_as whatIsBuilding compileAsWhat)
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests})
)
if (${use_cppunittest})
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_dll)
compileTargetAsC99(${whatIsBuilding}_testsonly_lib)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_dll)
compileTargetAsC11(${whatIsBuilding}_testsonly_lib)
endif()
endif()
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
else()
if(
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests})
)
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
else()
@@ -581,10 +581,10 @@ function(compile_c_test_artifacts_as whatIsBuilding compileAsWhat)
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests})
)
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
endif()
@@ -641,8 +641,8 @@ function(set_platform_files c_shared_dir)
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_win32.c PARENT_SCOPE)
endif()
if(use_etw)
- if(${use_etw} OR (${use_etw} STREQUAL "ON_WITH_CONSOLE"))
- if (${use_etw} STREQUAL "ON_WITH_CONSOLE")
+ if(use_etw OR (use_etw STREQUAL "ON_WITH_CONSOLE"))
+ if (use_etw STREQUAL "ON_WITH_CONSOLE")
set(XLOGGING_C_FILE ${c_shared_dir}/src/etwxlogging.c PARENT_SCOPE)
set(LOGGING_C_FILE ${c_shared_dir}/src/etwlogger_driver.c ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE)
set(LOGGING_RC_FILE ${c_shared_dir}/res/etwlogger.rc CACHE INTERNAL "")

View File

@@ -0,0 +1,256 @@
diff --git a/configs/azure_c_shared_utilityFunctions.cmake b/configs/azure_c_shared_utilityFunctions.cmake
index 6c2f415..e6133af 100644
--- a/configs/azure_c_shared_utilityFunctions.cmake
+++ b/configs/azure_c_shared_utilityFunctions.cmake
@@ -2,11 +2,11 @@
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
function(target_link_libraries_with_arg_prefix arg_prefix whatIsBuilding lib)
- if(${arg_prefix} STREQUAL "debug")
+ if(arg_prefix STREQUAL "debug")
target_link_libraries(${whatIsBuilding} debug ${lib})
- elseif(${arg_prefix} STREQUAL "optimized")
+ elseif(arg_prefix STREQUAL "optimized")
target_link_libraries(${whatIsBuilding} optimized ${lib})
- elseif(${arg_prefix} STREQUAL "general")
+ elseif(arg_prefix STREQUAL "general")
target_link_libraries(${whatIsBuilding} general ${lib})
else()
target_link_libraries(${whatIsBuilding} ${lib})
@@ -43,13 +43,13 @@ function(windows_unittests_add_dll whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -57,7 +57,7 @@ function(windows_unittests_add_dll whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f})
@@ -90,13 +90,13 @@ function(windows_unittests_add_exe whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -104,7 +104,7 @@ function(windows_unittests_add_exe whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -150,14 +150,14 @@ function(linux_unittests_add_exe whatIsBuilding)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
set(skip_to_next TRUE)
#also unset all the other states
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -165,7 +165,7 @@ function(linux_unittests_add_exe whatIsBuilding)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -184,7 +184,7 @@ function(linux_unittests_add_exe whatIsBuilding)
if(${run_valgrind})
find_program(VALGRIND_FOUND NAMES valgrind)
- if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
+ if(VALGRIND_FOUND STREQUAL VALGRIND_FOUND-NOTFOUND)
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
else()
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
@@ -307,13 +307,13 @@ function(c_windows_unittests_add_dll whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -321,7 +321,7 @@ function(c_windows_unittests_add_dll whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f})
@@ -369,13 +369,13 @@ function(c_windows_unittests_add_exe whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -383,7 +383,7 @@ function(c_windows_unittests_add_exe whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -429,13 +429,13 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
set(ARG_PREFIX "none")
foreach(f ${ARGN})
set(skip_to_next FALSE)
- if(${f} STREQUAL "ADDITIONAL_LIBS")
+ if(f STREQUAL "ADDITIONAL_LIBS")
SET(PARSING_ADDITIONAL_LIBS ON)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
set(ARG_PREFIX "none")
#also unset all the other states
set(skip_to_next TRUE)
- elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
+ elseif(f STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
SET(PARSING_ADDITIONAL_LIBS OFF)
SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
set(skip_to_next TRUE)
@@ -443,7 +443,7 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
if(NOT skip_to_next)
if(PARSING_ADDITIONAL_LIBS)
- if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
+ if((f STREQUAL "debug") OR (f STREQUAL "optimized") OR (f STREQUAL "general"))
SET(ARG_PREFIX ${f})
else()
target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
@@ -462,7 +462,7 @@ function(c_linux_unittests_add_exe whatIsBuilding folder)
if(${run_valgrind})
find_program(VALGRIND_FOUND NAMES valgrind)
- if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
+ if(VALGRIND_FOUND STREQUAL VALGRIND_FOUND-NOTFOUND)
message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
else()
add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
@@ -546,29 +546,29 @@ function(compile_c_test_artifacts_as whatIsBuilding compileAsWhat)
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests})
)
if (${use_cppunittest})
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_dll)
compileTargetAsC99(${whatIsBuilding}_testsonly_lib)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_dll)
compileTargetAsC11(${whatIsBuilding}_testsonly_lib)
endif()
endif()
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
else()
if(
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${nuget_e2e_tests})
)
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
else()
@@ -581,10 +581,10 @@ function(compile_c_test_artifacts_as whatIsBuilding compileAsWhat)
(("${whatIsBuilding}" MATCHES ".*e2e.*") AND ${run_e2e_tests}) OR
(("${whatIsBuilding}" MATCHES ".*int.*") AND ${run_int_tests})
)
- if(${compileAsWhat} STREQUAL "C99")
+ if(compileAsWhat STREQUAL "C99")
compileTargetAsC99(${whatIsBuilding}_exe)
endif()
- if(${compileAsWhat} STREQUAL "C11")
+ if(compileAsWhat STREQUAL "C11")
compileTargetAsC11(${whatIsBuilding}_exe)
endif()
endif()
@@ -641,15 +641,15 @@ function(set_platform_files c_shared_dir)
set(CONDITION_C_FILE ${c_shared_dir}/adapters/condition_win32.c PARENT_SCOPE)
endif()
- if(${use_etw} STREQUAL "OFF")
+ if(use_etw STREQUAL "OFF")
set(XLOGGING_C_FILE ${c_shared_dir}/src/xlogging.c PARENT_SCOPE)
set(LOGGING_C_FILE ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE)
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/consolelogger.h PARENT_SCOPE)
- elseif(${use_etw} STREQUAL "TRACELOGGING")
+ elseif(use_etw STREQUAL "TRACELOGGING")
set(XLOGGING_C_FILE ${c_shared_dir}/src/etwxlogging.c PARENT_SCOPE)
set(LOGGING_C_FILE ${c_shared_dir}/src/etwlogger_driver.c PARENT_SCOPE)
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/etwlogger_driver.h PARENT_SCOPE)
- elseif(${use_etw} STREQUAL "TRACELOGGING_WITH_CONSOLE")
+ elseif(use_etw STREQUAL "TRACELOGGING_WITH_CONSOLE")
set(XLOGGING_C_FILE ${c_shared_dir}/src/etwxlogging.c PARENT_SCOPE)
set(LOGGING_C_FILE ${c_shared_dir}/src/etwlogger_driver.c ${c_shared_dir}/src/consolelogger.c PARENT_SCOPE)
set(LOGGING_H_FILE ${c_shared_dir}/inc/azure_c_shared_utility/etwlogger_driver.h ${c_shared_dir}/inc/azure_c_shared_utility/consolelogger.h PARENT_SCOPE)

View File

@@ -0,0 +1,68 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46334c1..aaeea20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,7 +115,6 @@ if(${use_openssl})
if (NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto OR NOT ${OPENSSL_INCLUDE_DIR})
find_package(OpenSSL REQUIRED)
endif()
- include_directories(${OPENSSL_INCLUDE_DIR})
endif()
if(${use_applessl})
@@ -521,8 +520,7 @@ if(${use_http})
set(CURL_FIND_REQUIRED 1)
find_package_handle_standard_args(CURL DEFAULT_MSG CURL_LIBRARIES)
- include_directories(${CURL_INCLUDE_DIRS})
- set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} ${CURL_LIBRARIES})
+ set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} CURL::libcurl)
endif(NOT use_builtin_httpapi)
endif()
endif(${use_http})
@@ -561,7 +559,7 @@ if(${use_bearssl})
endif()
if(${use_openssl})
- set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} ${OPENSSL_LIBRARIES})
+ set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} OpenSSL::SSL)
if (WIN32)
set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} crypt32 ws2_32 secur32)
endif()
@@ -703,7 +701,7 @@ write_basic_package_version_file(
configure_file("configs/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
- COPYONLY
+ @ONLY
)
install(EXPORT aziotsharedutilTargets
@@ -715,7 +713,7 @@ install(EXPORT aziotsharedutilTargets
install(
FILES
- "configs/${PROJECT_NAME}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
"configs/${PROJECT_NAME}Functions.cmake"
"configs/azure_iot_build_rules.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
diff --git a/configs/azure_c_shared_utilityConfig.cmake b/configs/azure_c_shared_utilityConfig.cmake
index 52f2c7e1..11e9332b 100644
--- a/configs/azure_c_shared_utilityConfig.cmake
+++ b/configs/azure_c_shared_utilityConfig.cmake
@@ -1,6 +1,14 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
+include(CMakeFindDependencyMacro)
+if("@use_openssl@")
+ find_dependency(OpenSSL)
+endif()
+if(UNIX AND NOT "@use_builtin_httpapi@")
+ find_dependency(CURL)
+endif()
+
include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityTargets.cmake")
get_target_property(AZURE_C_SHARED_UTILITY_INCLUDES aziotsharedutil INTERFACE_INCLUDE_DIRECTORIES)

View File

@@ -0,0 +1,67 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46334c1..aaeea20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,7 +115,6 @@ if(${use_openssl})
if (NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto OR NOT ${OPENSSL_INCLUDE_DIR})
find_package(OpenSSL REQUIRED)
endif()
- include_directories(${OPENSSL_INCLUDE_DIR})
endif()
if(${use_applessl})
@@ -521,8 +520,7 @@ if(${use_http})
set(CURL_FIND_REQUIRED 1)
find_package_handle_standard_args(CURL DEFAULT_MSG CURL_LIBRARIES)
- include_directories(${CURL_INCLUDE_DIRS})
- set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} ${CURL_LIBRARIES})
+ set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} CURL::libcurl)
endif(NOT use_builtin_httpapi)
endif()
endif(${use_http})
@@ -561,7 +559,7 @@ if(${use_bearssl})
endif()
if(${use_openssl})
- set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} ${OPENSSL_LIBRARIES})
+ set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} OpenSSL::SSL)
if (WIN32)
set(aziotsharedutil_target_libs ${aziotsharedutil_target_libs} crypt32 ws2_32 secur32)
endif()
@@ -703,7 +701,7 @@ write_basic_package_version_file(
configure_file("configs/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
- COPYONLY
+ @ONLY
)
install(EXPORT aziotsharedutilTargets
@@ -715,7 +713,7 @@ install(EXPORT aziotsharedutilTargets
install(
FILES
- "configs/${PROJECT_NAME}Config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
"configs/${PROJECT_NAME}Functions.cmake"
"configs/azure_iot_build_rules.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
diff --git a/configs/azure_c_shared_utilityConfig.cmake b/configs/azure_c_shared_utilityConfig.cmake
index 416dd1c..0e1e4d4 100644
--- a/configs/azure_c_shared_utilityConfig.cmake
+++ b/configs/azure_c_shared_utilityConfig.cmake
@@ -1,8 +1,11 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
-if(UNIX)
- include(CMakeFindDependencyMacro)
+include(CMakeFindDependencyMacro)
+if("@use_openssl@")
+ find_dependency(OpenSSL)
+endif()
+if(UNIX AND NOT "@use_builtin_httpapi@")
find_dependency(CURL)
endif()

View File

@@ -0,0 +1,13 @@
diff --git a/adapters/x509_openssl.c b/adapters/x509_openssl.c
index 5a9e5ac2..bb946c2d 100644
--- a/adapters/x509_openssl.c
+++ b/adapters/x509_openssl.c
@@ -75,7 +75,7 @@ static int load_certificate_chain(SSL_CTX* ssl_ctx, const char* certificate)
// certificates.
/* Codes_SRS_X509_OPENSSL_07_006: [ If successful x509_openssl_add_ecc_credentials shall to import each certificate in the cert chain. ] */
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && (OPENSSL_VERSION_NUMBER < 0x20000000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
SSL_CTX_clear_extra_chain_certs(ssl_ctx);
#else
if (ssl_ctx->extra_certs != NULL)

View File

@@ -0,0 +1,53 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if("public-preview" IN_LIST FEATURES)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-c-shared-utility
REF 42574842914591aadc77701aac72f18cc72319ad
SHA512 dfe6ccede4bebdb3a39fbfea1dc55ddca57cced0d2656ee4bed1a5e5c9c434e1f2d892eb4e29bbb424cb9a02f2374a95fb9a020442bea580d39c242efad1b789
HEAD_REF master
PATCHES
fix-install-location-preview.patch
fix-utilityFunctions-conditions-preview.patch
disable-error.patch
improve-dependencies-preview.patch
)
else()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-c-shared-utility
REF 1a27846886a74702d409a8f0e2d77a38163cefc7
SHA512 c30cba73692691fe1310b6180e3aeaf4d86b6276981c680cac31d605634e5dedbce3f823142dfebba4ae2f76ccead965a527d95df0e52af638a30ddec9818fbd
HEAD_REF master
PATCHES
openssl.patch
fix-install-location.patch
fix-utilityFunctions-conditions.patch
disable-error.patch
improve-dependencies.patch
)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-Dskip_samples=ON
-Duse_installed_dependencies=ON
-Duse_default_uuid=ON
-Dbuild_as_dynamic=OFF
MAYBE_UNUSED_VARIABLES
build_as_dynamic
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME azure_c_shared_utility CONFIG_PATH lib/cmake/azure_c_shared_utility)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
file(COPY "${SOURCE_PATH}/configs/azure_iot_build_rules.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
vcpkg_copy_pdbs()

View File

@@ -0,0 +1,56 @@
{
"name": "azure-c-shared-utility",
"version-date": "2022-01-21",
"port-version": 3,
"description": "Azure C SDKs common code",
"homepage": "https://github.com/Azure/azure-c-shared-utility",
"license": "MIT",
"supports": "!uwp",
"dependencies": [
"azure-macro-utils-c",
{
"name": "curl",
"platform": "linux"
},
{
"name": "openssl",
"platform": "linux"
},
"umock-c",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"public-preview": {
"description": "Azure C SDKs common code (public preview)",
"dependencies": [
{
"name": "azure-macro-utils-c",
"features": [
"public-preview"
]
},
{
"name": "curl",
"platform": "linux"
},
{
"name": "openssl",
"platform": "linux"
},
{
"name": "umock-c",
"features": [
"public-preview"
]
}
]
}
}
}