diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-09-24 14:59:31 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-09-24 14:59:31 -0700 |
| commit | c084742b80d6514b39824617a41eb16910c53cf4 (patch) | |
| tree | 5081bed1a7420d076269ae5a766634154c8e4414 /src | |
| parent | 9d67af764fbc65cd8b96fbd86d295e55c96126cc (diff) | |
| download | nng-c084742b80d6514b39824617a41eb16910c53cf4.tar.gz nng-c084742b80d6514b39824617a41eb16910c53cf4.tar.bz2 nng-c084742b80d6514b39824617a41eb16910c53cf4.zip | |
fixes #735 Configuring ZeroTier for a unified build is too hard
This changes the code to make use of a different project we have
created (libzerotiercore) that is "CMake clean". This should make
using and configuring this code *much* better. It may also have the
benefit of making this configuration work better for Windows systems.
Diffstat (limited to 'src')
| -rw-r--r-- | src/transport/zerotier/CMakeLists.txt | 46 | ||||
| -rw-r--r-- | src/transport/zerotier/zerotier.c | 2 |
2 files changed, 17 insertions, 31 deletions
diff --git a/src/transport/zerotier/CMakeLists.txt b/src/transport/zerotier/CMakeLists.txt index 8ca78f0f..d8dbb566 100644 --- a/src/transport/zerotier/CMakeLists.txt +++ b/src/transport/zerotier/CMakeLists.txt @@ -10,43 +10,29 @@ # ZeroTier protocol -set (NNG_TRANSPORT_ZEROTIER_SOURCE "" CACHE PATH "Location of ZeroTier source tree.") -mark_as_advanced(NNG_TRANSPORT_ZEROTIER_SOURCE) - if (NNG_TRANSPORT_ZEROTIER) - # We use the libzerotiercore.a library, which is unfortunately a C++ object - # even though it exposes only public C symbols. It would be extremely - # helpful if libzerotiercore didn't make us carry the whole C++ runtime - # behind us. The user must specify the location of the ZeroTier source - # tree (dev branch for now, and already compiled please) by setting the - # NNG_ZEROTIER_SOURCE macro. - # NB: This needs to be the zerotierone tree, not the libzt library. - # This is because we don't access the API, but instead use the low - # level zerotiercore functionality directly. + # The zerotiercore project will have been found at the top level + # of the package. This is necessary because import libraries cannot + # percolate back to the parent tree. + # NB: As we wind up linking libzerotiercore.a into the application, # this means that your application will *also* need to either be licensed # under the GPLv3, or you will need to have a commercial license from # ZeroTier permitting its use elsewhere. - - enable_language(CXX) - find_library(NNG_LIBZTCORE zerotiercore PATHS ${NNG_TRANSPORT_ZEROTIER_SOURCE}) - if (NNG_LIBZTCORE) - set(CMAKE_REQUIRED_INCLUDES ${NNG_TRANSPORT_ZEROTIER_SOURCE}/include) - message(STATUS "C++ ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}") - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}) - set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} PARENT_SCOPE) - set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} ${NNG_TRANSPORT_ZEROTIER_SOURCE}/include PARENT_SCOPE) - nng_check_sym(ZT_Node_join ZeroTierOne.h HAVE_ZTCORE) - endif() - if (NOT HAVE_ZTCORE) - message (FATAL_ERROR "Cannot find ZeroTier components") - endif() - message(STATUS "Found ZeroTier at ${NNG_LIBZTCORE}") + + message(WARNING " + ************************************************************ + Linking against zerotiercore changes license terms (GPLv3). + 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) set(ZT_SOURCES transport/zerotier/zerotier.c transport/zerotier/zerotier.h) set(ZT_HEADERS transport/zerotier/zerotier.h) -endif() -set(NNG_SOURCES ${NNG_SOURCES} ${ZT_SOURCES} PARENT_SCOPE) -set(NNG_HEADERS ${NNG_HEADERS} ${ZT_HEADERS} PARENT_SCOPE) + set(NNG_SOURCES ${NNG_SOURCES} ${ZT_SOURCES} PARENT_SCOPE) + set(NNG_HEADERS ${NNG_HEADERS} ${ZT_HEADERS} PARENT_SCOPE) +endif() diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c index 1fc128b7..0cd83ee7 100644 --- a/src/transport/zerotier/zerotier.c +++ b/src/transport/zerotier/zerotier.c @@ -16,7 +16,7 @@ #include "core/nng_impl.h" #include "zerotier.h" -#include <ZeroTierOne.h> +#include <zerotiercore/ZeroTierOne.h> // ZeroTier Transport. This sits on the ZeroTier L2 network, which itself // is implemented on top of UDP. This requires the 3rd party |
