aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-11-13 22:31:18 -0800
committerGarrett D'Amore <garrett@damore.org>2020-11-14 21:31:43 -0800
commiteb328da56c3fc7167b536dcb206df0abb0f4a9b9 (patch)
treec92e3dd3db6a0f1b0efc6a027e7e4db6442068f0 /src/supplemental
parent7c1ff5ed1e48af413494b9070cccf79f3858b749 (diff)
downloadnng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.tar.gz
nng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.tar.bz2
nng-eb328da56c3fc7167b536dcb206df0abb0f4a9b9.zip
fixes #1087 CMakeLists structural improvements desired
This doesn't modularize all the tests yet, but it goes a long way in the right direction.
Diffstat (limited to 'src/supplemental')
-rw-r--r--src/supplemental/http/CMakeLists.txt27
-rw-r--r--src/supplemental/tls/CMakeLists.txt11
-rw-r--r--src/supplemental/tls/mbedtls/CMakeLists.txt12
-rw-r--r--src/supplemental/tls/wolfssl/CMakeLists.txt8
4 files changed, 16 insertions, 42 deletions
diff --git a/src/supplemental/http/CMakeLists.txt b/src/supplemental/http/CMakeLists.txt
index 2b8696b6..324484d8 100644
--- a/src/supplemental/http/CMakeLists.txt
+++ b/src/supplemental/http/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
# Copyright 2018 Capitar IT Group BV <info@capitar.com>
#
# This software is supplied under the terms of the MIT License, a
@@ -13,20 +13,15 @@ if (NNG_ENABLE_HTTP)
set(NNG_SUPP_HTTP ON)
endif()
mark_as_advanced(NNG_ENABLE_HTTP)
-set(_SRCS supplemental/http/http_public.c
- ${PROJECT_SOURCE_DIR}/include/nng/supplemental/http/http.h
- supplemental/http/http_api.h)
-if (NNG_SUPP_HTTP)
- 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)
-endif()
+nng_sources(http_public.c http_api.h)
+nng_headers(nng/supplemental/http/http.h)
-set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
-set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+nng_defines_if(NNG_SUPP_HTTP NNG_SUPP_HTTP)
+nng_sources_if(NNG_SUPP_HTTP
+ http_client.c
+ http_chunk.c
+ http_conn.c
+ http_msg.c
+ http_public.c
+ http_server.c)
diff --git a/src/supplemental/tls/CMakeLists.txt b/src/supplemental/tls/CMakeLists.txt
index 61d9f2fb..17d957ff 100644
--- a/src/supplemental/tls/CMakeLists.txt
+++ b/src/supplemental/tls/CMakeLists.txt
@@ -11,7 +11,6 @@
# found online at https://opensource.org/licenses/MIT.
#
-
if (NNG_ENABLE_TLS)
set(NNG_TLS_ENGINES mbed wolf none)
# We assume Mbed for now. (Someday replaced perhaps with Bear.)
@@ -34,13 +33,3 @@ add_subdirectory(wolfssl)
nng_sources(tls_common.c)
nng_sources(tls_api.h)
-
-list(APPEND NNG_DEFS ${_DEFS})
-list(APPEND NNG_SRCS ${_SRCS})
-list(APPEND NNG_LIBS ${_LIBS})
-list(APPEND NNG_INCS ${_INCS})
-
-set(NNG_DEFS ${NNG_DEFS} PARENT_SCOPE)
-set(NNG_SRCS ${NNG_SRCS} PARENT_SCOPE)
-set(NNG_LIBS ${NNG_LIBS} PARENT_SCOPE)
-set(NNG_INCS ${NNG_INCS} PARENT_SCOPE)
diff --git a/src/supplemental/tls/mbedtls/CMakeLists.txt b/src/supplemental/tls/mbedtls/CMakeLists.txt
index 22c8e1c6..a0af30c3 100644
--- a/src/supplemental/tls/mbedtls/CMakeLists.txt
+++ b/src/supplemental/tls/mbedtls/CMakeLists.txt
@@ -21,16 +21,10 @@ if (NNG_TLS_ENGINE STREQUAL "mbed")
# If Mbed TLS was added by a consuming project, then we should use that
# instance of it, instead of configuring our own.
if (TARGET mbedtls)
- set(_LIBS mbedtls)
+ nng_link_libraries(mbedtls)
else()
find_package(mbedTLS REQUIRED)
- set(_LIBS ${MBEDTLS_LIBRARIES})
- set(_INCS ${MBEDTLS_INCLUDE_DIR})
+ nng_link_libraries(${MBEDTLS_LIBRARIES})
+ nng_include_directories(${MBEDTLS_INCLUDE_DIR})
endif()
-
- list(APPEND NNG_LIBS ${_LIBS})
- list(APPEND NNG_INCS ${_INCS})
-
- set(NNG_LIBS ${NNG_LIBS} PARENT_SCOPE)
- set(NNG_INCS ${NNG_INCS} PARENT_SCOPE)
endif()
diff --git a/src/supplemental/tls/wolfssl/CMakeLists.txt b/src/supplemental/tls/wolfssl/CMakeLists.txt
index f0b48d9a..f38f5dbe 100644
--- a/src/supplemental/tls/wolfssl/CMakeLists.txt
+++ b/src/supplemental/tls/wolfssl/CMakeLists.txt
@@ -13,14 +13,10 @@
if (NNG_TLS_ENGINE STREQUAL "wolf")
add_subdirectory(${PROJECT_SOURCE_DIR}/extern/nng-wolfssl nng-wolfssl)
- target_include_directories(nng-wolfssl PRIVATE )
- target_link_libraries(nng PRIVATE nng-wolfssl)
- if (TARGET nng_testlib)
- target_link_libraries(nng_testlib PRIVATE nng-wolfssl)
- endif ()
+ target_include_directories(nng-wolfssl PRIVATE)
+ nng_check_lib(nng-wolfssl)
nng_defines(NNG_TLS_ENGINE_INIT=nng_tls_engine_init_wolf)
nng_defines(NNG_TLS_ENGINE_FINI=nng_tls_engine_fini_wolf)
nng_defines(NNG_SUPP_TLS)
-
endif ()