9f441698f8d607e473a3365e742eda3090b5a046
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / libiio / 0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch
1 From 4f849e1d2287206cfb7ff0fdeca96c22383b0d53 Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Mon, 29 Dec 2014 19:05:13 +0100
4 Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from
5  libxml2
6
7 Libxml2 >=2.9.2 provides its own CMake module, so check for it before
8 falling back on the CMake's module FindLibXml2.cmake.
9
10 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
11 ---
12  CMakeLists.txt | 14 +++++++++++++-
13  1 file changed, 13 insertions(+), 1 deletion(-)
14
15 diff --git a/CMakeLists.txt b/CMakeLists.txt
16 index 393fee3..b4f1d26 100644
17 --- a/CMakeLists.txt
18 +++ b/CMakeLists.txt
19 @@ -38,7 +38,19 @@ endif()
20  find_library(AVAHI_CLIENT_LIBRARIES avahi-client)
21  find_library(AVAHI_COMMON_LIBRARIES avahi-common)
22  find_library(PTHREAD_LIBRARIES pthread)
23 -include(FindLibXml2)
24 +
25 +# Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all
26 +# variables correctly set.
27 +# So, try first to find the CMake module provided by libxml2 package, then fallback
28 +# on the CMake's FindLibXml2.cmake module (which can lack some definition, especially
29 +# in static build case).
30 +find_package(LibXml2 QUIET NO_MODULE)
31 +if(DEFINED LIBXML2_VERSION_STRING)
32 +  set(LIBXML2_FOUND ON)
33 +  set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS})
34 +else()
35 +  include(FindLibXml2)
36 +endif()
37  
38  set(LIBIIO_CFILES channel.c device.c context.c buffer.c utilities.c)
39  set(LIBIIO_HEADERS iio.h)
40 -- 
41 2.2.1
42