aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental
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
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')
-rw-r--r--src/supplemental/base64/CMakeLists.txt6
-rw-r--r--src/supplemental/http/CMakeLists.txt30
-rw-r--r--src/supplemental/sha1/CMakeLists.txt6
-rw-r--r--src/supplemental/tls/CMakeLists.txt40
-rw-r--r--src/supplemental/util/CMakeLists.txt8
-rw-r--r--src/supplemental/websocket/CMakeLists.txt6
6 files changed, 45 insertions, 51 deletions
diff --git a/src/supplemental/base64/CMakeLists.txt b/src/supplemental/base64/CMakeLists.txt
index 297a5478..83740c83 100644
--- a/src/supplemental/base64/CMakeLists.txt
+++ b/src/supplemental/base64/CMakeLists.txt
@@ -1,6 +1,6 @@
#
# Copyright 2017 Capitar IT Group BV <info@capitar.com>
-# Copyright 2017 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
#
# This software is supplied under the terms of the MIT License, a
# copy of which should be located in the distribution where this
@@ -9,8 +9,8 @@
#
if (NNG_SUPP_BASE64)
- set(BASE64_SOURCES
+ set(_SRCS
supplemental/base64/base64.c
supplemental/base64/base64.h)
+ set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${BASE64_SOURCES} PARENT_SCOPE)
diff --git a/src/supplemental/http/CMakeLists.txt b/src/supplemental/http/CMakeLists.txt
index ed7d5ae2..0fe9e7c5 100644
--- a/src/supplemental/http/CMakeLists.txt
+++ b/src/supplemental/http/CMakeLists.txt
@@ -8,28 +8,26 @@
# found online at https://opensource.org/licenses/MIT.
#
+option (NNG_ENABLE_HTTP "Enable HTTP API" ON)
+if (NNG_ENABLE_HTTP)
+ set(NNG_SUPP_HTTP ON)
+endif()
+mark_as_advanced(NNG_ENABLE_HTTP)
+
+set(_HDRS supplemental/http/http.h)
+set(_SRCS ${_HDRS} supplemental/http/http_public.c supplemental/http/http_api.h)
+
if (NNG_SUPP_HTTP)
- set(HTTP_DEFINES -DNNG_SUPP_HTTP)
- set(HTTP_HEADERS
- supplemental/http/http.h)
- set(HTTP_SOURCES
- supplemental/http/http.h
- supplemental/http/http_api.h
+ set(_DEFS -DNNG_SUPP_HTTP)
+ list(APPEND _SRCS
supplemental/http/http_client.c
supplemental/http/http_chunk.c
supplemental/http/http_conn.c
supplemental/http/http_msg.c
supplemental/http/http_public.c
supplemental/http/http_server.c)
-else()
- set(HTTP_SOURCES
- supplemental/http/http.h
- supplemental/http/http_api.h
- supplemental/http/http_public.c)
- set(HTTP_HEADERS
- supplemental/http/http.h)
endif()
-set(NNG_DEFINES ${NNG_DEFINES} ${HTTP_DEFINES} PARENT_SCOPE)
-set(NNG_SOURCES ${NNG_SOURCES} ${HTTP_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${HTTP_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
diff --git a/src/supplemental/sha1/CMakeLists.txt b/src/supplemental/sha1/CMakeLists.txt
index 9600a268..370dc7c2 100644
--- a/src/supplemental/sha1/CMakeLists.txt
+++ b/src/supplemental/sha1/CMakeLists.txt
@@ -1,6 +1,6 @@
#
# Copyright 2017 Capitar IT Group BV <info@capitar.com>
-# Copyright 2017 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
#
# This software is supplied under the terms of the MIT License, a
# copy of which should be located in the distribution where this
@@ -9,8 +9,8 @@
#
if (NNG_SUPP_SHA1)
- set(SHA1_SOURCES
+ set(_SRCS
supplemental/sha1/sha1.c
supplemental/sha1/sha1.h)
+ set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${SHA1_SOURCES} PARENT_SCOPE)
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)
diff --git a/src/supplemental/util/CMakeLists.txt b/src/supplemental/util/CMakeLists.txt
index f94e2b45..c61d8a09 100644
--- a/src/supplemental/util/CMakeLists.txt
+++ b/src/supplemental/util/CMakeLists.txt
@@ -8,8 +8,8 @@
# found online at https://opensource.org/licenses/MIT.
#
-set(SUPP_UTIL_SOURCES supplemental/util/options.c supplemental/util/platform.c)
-set(SUPP_UTIL_HEADERS supplemental/util/options.h supplemental/util/platform.h)
+set(_SRCS supplemental/util/options.c supplemental/util/platform.c)
+set(_HDRS supplemental/util/options.h supplemental/util/platform.h)
-set(NNG_SOURCES ${NNG_SOURCES} ${SUPP_UTIL_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${SUPP_UTIL_HEADERS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
diff --git a/src/supplemental/websocket/CMakeLists.txt b/src/supplemental/websocket/CMakeLists.txt
index 5ddd6cb1..22ee955d 100644
--- a/src/supplemental/websocket/CMakeLists.txt
+++ b/src/supplemental/websocket/CMakeLists.txt
@@ -1,6 +1,6 @@
#
# Copyright 2017 Capitar IT Group BV <info@capitar.com>
-# Copyright 2017 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
#
# This software is supplied under the terms of the MIT License, a
# copy of which should be located in the distribution where this
@@ -9,8 +9,8 @@
#
if (NNG_SUPP_WEBSOCKET)
- set(WEBSOCKET_SOURCES
+ set(_SRCS
supplemental/websocket/websocket.c
supplemental/websocket/websocket.h)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${WEBSOCKET_SOURCES} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)