From de34ad2cda8aca74c4160a7dec411b1f3ad27e3f Mon Sep 17 00:00:00 2001
From: Marvin Klimke <marvin.klimke@rwth-aachen.de>
Date: Fri, 16 Nov 2018 16:08:55 +0100
Subject: [PATCH] add rtp node to CMakeLists adapted from libnanomsg
 dependencies

---
 CMakeLists.txt           | 4 ++++
 lib/nodes/CMakeLists.txt | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33e716cbc..b6487f34e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,6 +109,10 @@ pkg_check_modules(NANOMSG IMPORTED_TARGET nanomsg)
 if(NOT NANOMSG_FOUND)
     pkg_check_modules(NANOMSG IMPORTED_TARGET libnanomsg>=1.0.0)
 endif()
+pkg_check_modules(RE IMPORTED_TARGET re)
+if(NOT RE_FOUND)
+    pkg_check_modules(RE IMPORTED_TARGET libre>=1.0.0)
+endif()
 
 # Build options
 option(WITH_HOOKS   "Build with support for processing hook plugins" ON)
diff --git a/lib/nodes/CMakeLists.txt b/lib/nodes/CMakeLists.txt
index 3a6cc92bd..4b14ea9df 100644
--- a/lib/nodes/CMakeLists.txt
+++ b/lib/nodes/CMakeLists.txt
@@ -125,6 +125,13 @@ if(IBVERBS_FOUND AND RDMACM_FOUND)
     list(APPEND LIBRARIES ${IBVERBS_LIBRARIES} ${RDMACM_LIBRARIES})
 endif()
 
+# Enable RTP node type when libre is available
+if(RE_FOUND AND WITH_IO)
+    list(APPEND NODE_SRC rtp.c)
+    list(APPEND INCLUDE_DIRS ${RE_INCLUDE_DIRS})
+    list(APPEND LIBRARIES PkgConfig::RE)
+endif()
+
 add_library(nodes STATIC ${NODE_SRC})
 target_include_directories(nodes PUBLIC ${INCLUDE_DIRS})
 target_link_libraries(nodes LINK_PRIVATE ${LIBRARIES})