From 451731f0c6d3991008df9f173782fc26f28629ba Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 24 Apr 2017 23:20:39 +0200 Subject: [PATCH] cmake: fix build without libxml2 When LibXml2 is not found, the LIBXML2_LIBRARIES is set to "LIBXML2_LIBRARIES-NOTFOUND" rather than an empty string (as other FindXxx modules do). This results in an error because the variable is used in target_link_libraries (via epan_LIBS). As workaround, explicitly clear the variable to ignore the cache entry. Change-Id: I9e164f9c175b23559ac6bc37f9aca5f41df79d1f Reviewed-on: https://code.wireshark.org/review/21321 Petri-Dish: Peter Wu Reviewed-by: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Martin Kaiser Reviewed-by: Peter Wu --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a59883ad0a..586e6e12af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -997,6 +997,10 @@ if(SPANDSP_FOUND) endif() if(LIBXML2_FOUND) set(HAVE_LIBXML2 1) +else() + # The (official) FindLibXml2.cmake file sets this cache variable to a + # non-empty value, be sure to clear it when not found. + set(LIBXML2_LIBRARIES "") endif() if(EXTCAP_ANDROIDDUMP_LIBPCAP) set(ANDROIDDUMP_USE_LIBPCAP 1)