From 77984b14a65c0a7387c97f3d36f947dd17358744 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 5 Nov 2018 13:54:40 -0800 Subject: 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. --- src/transport/zerotier/CMakeLists.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/transport/zerotier') diff --git a/src/transport/zerotier/CMakeLists.txt b/src/transport/zerotier/CMakeLists.txt index d8dbb566..686a0a8a 100644 --- a/src/transport/zerotier/CMakeLists.txt +++ b/src/transport/zerotier/CMakeLists.txt @@ -10,6 +10,9 @@ # ZeroTier protocol +option (NNG_TRANSPORT_ZEROTIER "Enable ZeroTier transport (requires libzerotiercore)." OFF) +mark_as_advanced(NNG_TRANSPORT_ZEROTIER) + if (NNG_TRANSPORT_ZEROTIER) # The zerotiercore project will have been found at the top level @@ -27,12 +30,18 @@ if (NNG_TRANSPORT_ZEROTIER) Consult a lawyer and the license files for details. ************************************************************") - set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} zerotiercore::zerotiercore) - set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} PARENT_SCOPE) + find_package(zerotiercore REQUIRED) + set(_PKGS zerotiercore) + set(_LIBS zerotiercore::zerotiercore) + set(_DEFS -DNNG_TRANSPORT_ZEROTIER) + + set(_SRCS transport/zerotier/zerotier.c transport/zerotier/zerotier.h) + set(_HDRS transport/zerotier/zerotier.h) - set(ZT_SOURCES transport/zerotier/zerotier.c transport/zerotier/zerotier.h) - set(ZT_HEADERS transport/zerotier/zerotier.h) + set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) + set(NNG_LIBS ${NNG_LIBS} ${_LIBS} PARENT_SCOPE) + set(NNG_PKGS ${NNG_PKGS} ${_PKGS} PARENT_SCOPE) + set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) + set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE) - set(NNG_SOURCES ${NNG_SOURCES} ${ZT_SOURCES} PARENT_SCOPE) - set(NNG_HEADERS ${NNG_HEADERS} ${ZT_HEADERS} PARENT_SCOPE) endif() -- cgit v1.2.3-70-g09d2