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()