From 75c01e8c8d665e6b488698c1a50e9772c34bcda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 25 May 2025 09:44:06 +0200 Subject: [PATCH] core: fix build on FreeBSD (issue #2251) Check if the resolv library is found before checking if it has res_init. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d50bf1235..7a911aff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,9 +227,11 @@ check_symbol_exists("eat_newline_glitch" "term.h" HAVE_EAT_NEWLINE_GLITCH) check_function_exists(res_init, LIBC_HAS_RES_INIT) if(NOT LIBC_HAS_RES_INIT) find_library(RESOLV_LIBRARY resolv) - check_library_exists("${RESOLV_LIBRARY}" res_init "" LIBRESOLV_HAS_RES_INIT) - if(LIBRESOLV_HAS_RES_INIT) - list(APPEND EXTRA_LIBS ${RESOLV_LIBRARY}) + if(RESOLV_LIBRARY) + check_library_exists("${RESOLV_LIBRARY}" res_init "" LIBRESOLV_HAS_RES_INIT) + if(LIBRESOLV_HAS_RES_INIT) + list(APPEND EXTRA_LIBS ${RESOLV_LIBRARY}) + endif() endif() endif()