From f01e7188c8c5253449ff6774b195b9d1152eeeb7 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Wed, 4 Mar 2020 09:45:52 +0000 Subject: [PATCH] CMake libunbound fixups. 1. ub_ctx_set_stub is in unbound.h, not unbound-events.h. 2. Only bother looking for unbound event API if enabled. 3. If building stub only, ensure all libunbound items are off. This is necessary in case we first configure without stub only, and then change to stub only. Fixes #463 --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d22d3ca..10d10b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -489,9 +489,19 @@ if (NOT ENABLE_STUB_ONLY) set(CMAKE_REQUIRED_INCLUDES ${LIBUNBOUND_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${LIBUNBOUND_LIBRARIES}) - check_include_file(unbound-event.h HAVE_UNBOUND_EVENT_H) - check_symbol_exists(ub_ctx_create_ub_event "unbound-event.h" HAVE_UNBOUND_EVENT_API) - check_symbol_exists(ub_ctx_set_stub "unbound-event.h" HAVE_UB_CTX_SET_STUB) + + check_symbol_exists(ub_ctx_set_stub "unbound.h" HAVE_UB_CTX_SET_STUB) + + if (ENABLE_UNBOUND_EVENT_API) + check_include_file(unbound-event.h HAVE_UNBOUND_EVENT_H) + check_symbol_exists(ub_ctx_create_ub_event "unbound-event.h" HAVE_UNBOUND_EVENT_API) + endif () +else () + # Ensure we're not using libunbound items. + set(HAVE_LIBUNBOUND 0) + set(HAVE_UNBOUND_EVENT_H 0) + set(HAVE_UNBOUND_EVENT_API 0) + set(HAVE_UB_CTX_SET_STUB 0) endif () # Event loop extension