aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/tls
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-11-05 13:54:40 -0800
committerGarrett D'Amore <garrett@damore.org>2018-11-05 16:20:23 -0800
commit77984b14a65c0a7387c97f3d36f947dd17358744 (patch)
treed95ad88933c9fe8853cbc74fe8dc1492d60ad443 /src/supplemental/tls
parentdb92342b43d429b8b07244cc003a8589a1b1c542 (diff)
downloadnng-77984b14a65c0a7387c97f3d36f947dd17358744.tar.gz
nng-77984b14a65c0a7387c97f3d36f947dd17358744.tar.bz2
nng-77984b14a65c0a7387c97f3d36f947dd17358744.zip
fixes #577 target library dependencies should be public
This is a significant refactor of the library configuration. We use the modern package configuration helper, with a template script that also does the find_package dance for any of our dependencies. We also have restructured the code so that most protocols and transports have their configuration isolated to their own CMakeLists file, reducing the size of the global CMakeLists file.
Diffstat (limited to 'src/supplemental/tls')
-rw-r--r--src/supplemental/tls/CMakeLists.txt40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/supplemental/tls/CMakeLists.txt b/src/supplemental/tls/CMakeLists.txt
index a16745bd..3d1e6d02 100644
--- a/src/supplemental/tls/CMakeLists.txt
+++ b/src/supplemental/tls/CMakeLists.txt
@@ -10,36 +10,32 @@
if (NNG_SUPP_TLS)
set(NNG_SUPP_TLS_MBEDTLS ON)
- set(TLS_DEFINES -DNNG_SUPP_TLS)
+ set(_DEFS -DNNG_SUPP_TLS)
endif()
-set(TLS_SOURCES supplemental/tls/tls.h)
+
+set(_SRCS supplemental/tls/tls.h)
+set(_HDRS supplemental/tls/tls.h)
# For now we only support the ARM mbedTLS library.
if (NNG_SUPP_TLS_MBEDTLS)
Find_Package(mbedTLS REQUIRED)
+ set(_LIBS ${MBEDTLS_LIBRARIES})
+ set(_INCS ${MBEDTLS_INCLUDE_DIR})
+ list(APPEND _SRCS supplemental/tls/mbedtls/tls.c)
- # If it isn't already in the link list, add the TLS libraries there.
- # or something, so we take care not to duplicate it).
- list(FIND NNG_REQUIRED_LIBRARIES ${MBEDTLS_TLS_LIBRARY} _index)
- if (_index EQUAL -1)
- set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} ${MBEDTLS_LIBRARIES})
- set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} PARENT_SCOPE)
- endif()
-
- # Likewise for the include search path.
- list(FIND NNG_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIR} _index)
- if (_index EQUAL -1)
- set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} ${MBEDTLS_INCLUDE_DIR})
- set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} PARENT_SCOPE)
- endif()
- set(TLS_SOURCES ${TLS_SOURCES} supplemental/tls/mbedtls/tls.c)
else()
- set(TLS_SOURCES ${TLS_SOURCES} supplemental/tls/none/tls.c)
+ list(APPEND _SRCS supplemental/tls/none/tls.c)
endif()
-set(TLS_HEADERS supplemental/tls/tls.h)
+list(APPEND NNG_DEFS ${_DEFS})
+list(APPEND NNG_SRCS ${_SRCS})
+list(APPEND NNG_HDRS ${_HDRS})
+list(APPEND NNG_LIBS ${_LIBS})
+list(APPEND NNG_INCS ${_INCS})
-set(NNG_DEFINES ${NNG_DEFINES} ${TLS_DEFINES} PARENT_SCOPE)
-set(NNG_SOURCES ${NNG_SOURCES} ${TLS_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${TLS_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} PARENT_SCOPE)
+set(NNG_LIBS ${NNG_LIBS} PARENT_SCOPE)
+set(NNG_INCS ${NNG_INCS} PARENT_SCOPE)