From f508394909c3f5e95e303112ad086b9c0c3e99a4 Mon Sep 17 00:00:00 2001
From: Leander Schulten <Leander.Schulten@rwth-aachen.de>
Date: Mon, 27 Mar 2023 16:06:23 +0200
Subject: [PATCH] Don't assume that GnuTLS is on the search path

---
 CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bca946f1..f30ba679 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1380,6 +1380,9 @@ else()
   if(NOT MINGW)
     add_library(objects OBJECT ${sources})
     set_property(TARGET objects PROPERTY POSITION_INDEPENDENT_CODE ON)
+    if(GNUTLS_FOUND)
+      target_include_directories(objects PRIVATE "${GNUTLS_INCLUDE_DIR}")
+    endif()
   endif()
 
   if(BUILD_SHARED)
@@ -1467,6 +1470,7 @@ if(BUILD_SHARED)
   target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
   if(GNUTLS_FOUND)
     target_link_libraries(libzmq ${GNUTLS_LIBRARIES})
+    target_include_directories(libzmq PRIVATE "${GNUTLS_INCLUDE_DIR}")
   endif()
 
   if(NSS3_FOUND)
@@ -1512,6 +1516,7 @@ if(BUILD_STATIC)
   target_link_libraries(libzmq-static ${CMAKE_THREAD_LIBS_INIT})
   if(GNUTLS_FOUND)
     target_link_libraries(libzmq-static ${GNUTLS_LIBRARIES})
+    target_include_directories(libzmq-static PRIVATE "${GNUTLS_INCLUDE_DIR}")
   endif()
 
   if(LIBBSD_FOUND)
@@ -1580,6 +1585,7 @@ if(BUILD_SHARED)
 
       if(GNUTLS_FOUND)
         target_link_libraries(${perf-tool} ${GNUTLS_LIBRARIES})
+        target_include_directories(${perf-tool} PRIVATE "${GNUTLS_INCLUDE_DIR}")
       endif()
 
       if(LIBBSD_FOUND)