kumquat-buildroot/package/libiio/0001-cmake-libxml2-detection-try-first-the-CMake-module-f.patch

44 lines
1.4 KiB
Diff
Raw Normal View History

From b613e0fe7999cfff9efb646eb388ea1e58952e30 Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Thu, 14 Apr 2016 12:59:27 -0400
Subject: [PATCH] cmake: libxml2 detection: try CMake module from libxml2
Libxml2 >=2.9.2 provides its own CMake module, so check for it before
falling back on the CMake's module FindLibXml2.cmake.
Updated for v0.6 by: Matt Fornero <matt.fornero@mathworks.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Matt Fornero <matt.fornero@mathworks.com>
---
CMakeLists.txt | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70f61f0..4a4209b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,7 +143,18 @@ if(WITH_NETWORK_BACKEND)
endif()
if (NEED_LIBXML2)
- include(FindLibXml2)
+ # Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all
+ # variables correctly set.
+ # So, try first to find the CMake module provided by libxml2 package, then fallback
+ # on the CMake's FindLibXml2.cmake module (which can lack some definition, especially
+ # in static build case).
+ find_package(LibXml2 QUIET NO_MODULE)
+ if(DEFINED LIBXML2_VERSION_STRING)
+ set(LIBXML2_FOUND ON)
+ set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS})
+ else()
+ include(FindLibXml2)
+ endif()
if (NOT LIBXML2_FOUND)
message(SEND_ERROR "The selected backends require libxml2 to be installed")
--
1.7.10.4