summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2023-02-05 19:36:17 -0400
committerGitHub <noreply@github.com>2023-02-05 19:36:17 -0400
commitb6d26238fc4095e00656a1bc4f8ab780af3cb878 (patch)
tree4387c71da6949519e66eb7e5bf8ec92942713276
parente7a3e415ba0ca8daf22fecb235577e87d637864c (diff)
downloadnng-b6d26238fc4095e00656a1bc4f8ab780af3cb878.tar.gz
nng-b6d26238fc4095e00656a1bc4f8ab780af3cb878.tar.bz2
nng-b6d26238fc4095e00656a1bc4f8ab780af3cb878.zip
Fill NNG_PKGS to request nng dependencies from installed location. (#1641)
Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> Co-authored-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>
-rw-r--r--cmake/FindmbedTLS.cmake2
-rw-r--r--cmake/NNGHelpers.cmake10
-rw-r--r--src/platform/posix/CMakeLists.txt4
-rw-r--r--src/sp/transport/zerotier/CMakeLists.txt2
-rw-r--r--src/supplemental/tls/mbedtls/CMakeLists.txt2
5 files changed, 14 insertions, 6 deletions
diff --git a/cmake/FindmbedTLS.cmake b/cmake/FindmbedTLS.cmake
index f01039d6..804a0392 100644
--- a/cmake/FindmbedTLS.cmake
+++ b/cmake/FindmbedTLS.cmake
@@ -82,5 +82,5 @@ endif ()
string(REGEX REPLACE ".*MBEDTLS_VERSION_STRING[\t ]+\"(.*)\"" "\\1" MBEDTLS_VERSION ${_MBEDTLS_VERLINE})
find_package_handle_standard_args(mbedTLS
- REQUIRED_VARS MBEDTLS_TLS_LIBRARY MBEDTLS_CRYPTO_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_INCLUDE_DIR VERSION_VAR MBEDTLS_VERSION)
+ REQUIRED_VARS MBEDTLS_TLS_LIBRARY MBEDTLS_CRYPTO_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES VERSION_VAR MBEDTLS_VERSION)
diff --git a/cmake/NNGHelpers.cmake b/cmake/NNGHelpers.cmake
index d7596827..d97d800c 100644
--- a/cmake/NNGHelpers.cmake
+++ b/cmake/NNGHelpers.cmake
@@ -41,6 +41,14 @@ function(nng_defines)
target_compile_definitions(nng_private INTERFACE ${ARGN})
endfunction()
+# nng_find_package looks up required package and adds dependency to the cmake config.
+macro(nng_find_package PACKAGE_NAME)
+ find_package(${PACKAGE_NAME} REQUIRED)
+ list(APPEND NNG_PKGS ${PACKAGE_NAME})
+ list(REMOVE_DUPLICATES NNG_PKGS)
+ set(NNG_PKGS ${NNG_PKGS} CACHE INTERNAL "nng package dependencies" FORCE)
+endmacro()
+
# nng_link_libraries adds link dependencies to the libraries.
function(nng_link_libraries)
target_link_libraries(nng PRIVATE ${ARGN})
@@ -156,4 +164,4 @@ endfunction(nng_check_struct_member)
macro(nng_directory DIR)
set(NNG_TEST_PREFIX ${NNG_TEST_PREFIX}.${DIR})
-endmacro(nng_directory) \ No newline at end of file
+endmacro(nng_directory)
diff --git a/src/platform/posix/CMakeLists.txt b/src/platform/posix/CMakeLists.txt
index 7b619fa2..dcfea221 100644
--- a/src/platform/posix/CMakeLists.txt
+++ b/src/platform/posix/CMakeLists.txt
@@ -13,7 +13,7 @@
# the static library unless they also go into the dynamic.
if (NNG_PLATFORM_POSIX)
- find_package(Threads REQUIRED)
+ nng_find_package(Threads)
nng_link_libraries(Threads::Threads)
# Unconditionally declare the following feature test macros. These are
@@ -108,4 +108,4 @@ if (NNG_PLATFORM_POSIX)
nng_test(posix_ipcwinsec_test)
-endif () \ No newline at end of file
+endif ()
diff --git a/src/sp/transport/zerotier/CMakeLists.txt b/src/sp/transport/zerotier/CMakeLists.txt
index 903b7f56..dedc9296 100644
--- a/src/sp/transport/zerotier/CMakeLists.txt
+++ b/src/sp/transport/zerotier/CMakeLists.txt
@@ -28,7 +28,7 @@ if (NNG_TRANSPORT_ZEROTIER)
Consult a lawyer and the license files for details.
************************************************************")
- find_package(zerotiercore REQUIRED)
+ nng_find_package(zerotiercore)
nng_link_libraries(zerotiercore::zerotiercore)
nng_defines(NNG_TRANSPORT_ZEROTIER)
diff --git a/src/supplemental/tls/mbedtls/CMakeLists.txt b/src/supplemental/tls/mbedtls/CMakeLists.txt
index a0af30c3..2d639efa 100644
--- a/src/supplemental/tls/mbedtls/CMakeLists.txt
+++ b/src/supplemental/tls/mbedtls/CMakeLists.txt
@@ -23,7 +23,7 @@ if (NNG_TLS_ENGINE STREQUAL "mbed")
if (TARGET mbedtls)
nng_link_libraries(mbedtls)
else()
- find_package(mbedTLS REQUIRED)
+ nng_find_package(mbedTLS)
nng_link_libraries(${MBEDTLS_LIBRARIES})
nng_include_directories(${MBEDTLS_INCLUDE_DIR})
endif()