From patchwork Sun Jan 25 21:13:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 432607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id B71E4140273 for ; Mon, 26 Jan 2015 08:14:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 319F38B009; Sun, 25 Jan 2015 21:14:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KcmnNqS3GyUl; Sun, 25 Jan 2015 21:14:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7767F8B2E4; Sun, 25 Jan 2015 21:14:11 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id D779E1C2378 for ; Sun, 25 Jan 2015 21:14:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D64658A00D for ; Sun, 25 Jan 2015 21:14:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CM3S9gxIw-Py for ; Sun, 25 Jan 2015 21:14:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 28DE78A006 for ; Sun, 25 Jan 2015 21:14:06 +0000 (UTC) Received: by mail-we0-f178.google.com with SMTP id k48so6021023wev.9 for ; Sun, 25 Jan 2015 13:14:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JCLQoQOqR61QPJTdp+mCdNuKkWy2BowRkTW+sdA8/8I=; b=FOE9zo/8rtlXqP2AL5IG9WI4uOy8FdemCg+Btt6VcQNEg+WhpXFTqn48DE7yA4dPv9 Zs3I9m740FTl0EwL4bhDmbktO8/NeT9yb032IesmemtlM+SB+FvEvhvJHz3h1UQd//Cw AROcMez4hd2M4kkttPmGuGCCv/aJgkpGrV+EGPrGMrPIQjEgq1ZbYF/3upVgA/7kF+3S cbQDOUS99+2F7QeOTC6t48DvY76nBF2fjhh9c58h4/4ADT9337i3ibx5qHWgDQKjFAiC H0Yivbl9XlH7c5dUmnZnxQ7WPRSkPy8EOekTn/N8EBILcxWtBRqy2Zv23SIKvMhyXBtS G9HQ== X-Received: by 10.194.175.69 with SMTP id by5mr36963913wjc.32.1422220444810; Sun, 25 Jan 2015 13:14:04 -0800 (PST) Received: from bobook.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net. [82.229.165.48]) by mx.google.com with ESMTPSA id q5sm2571273wix.0.2015.01.25.13.14.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Jan 2015 13:14:04 -0800 (PST) From: Samuel Martin To: buildroot@buildroot.org Date: Sun, 25 Jan 2015 22:13:49 +0100 Message-Id: <1422220435-18689-3-git-send-email-s.martin49@gmail.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422220435-18689-1-git-send-email-s.martin49@gmail.com> References: <1422220435-18689-1-git-send-email-s.martin49@gmail.com> Subject: [Buildroot] [PATCH 2/8] package/libiio: update cmake code for libxml2 detection X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Only check for libxml2 when it is needed. This prevents CMake from falling back on the libxml2-config.cmake installed on the host system (i.e. when libxml2 >=2.9.2 is part of the host system), but not enabled as a target package (i.e. not existing in the staging tree). Signed-off-by: Samuel Martin --- ...l2-detection-try-first-the-CMake-module-f.patch | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch b/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch index 9f44169..43dcf62 100644 --- a/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch +++ b/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch @@ -1,4 +1,4 @@ -From 4f849e1d2287206cfb7ff0fdeca96c22383b0d53 Mon Sep 17 00:00:00 2001 +From 238ce46fec88f5cba092ed4d8b52104eb2e31af2 Mon Sep 17 00:00:00 2001 From: Samuel Martin Date: Mon, 29 Dec 2014 19:05:13 +0100 Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from @@ -7,36 +7,42 @@ Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from Libxml2 >=2.9.2 provides its own CMake module, so check for it before falling back on the CMake's module FindLibXml2.cmake. +Also, only check for libxml2 when needed (i.e. network backend is +enabled). This prevents CMake from finding the libxml2-config.cmake +when is installed on the host system, but not in the staging tree. + Signed-off-by: Samuel Martin --- - CMakeLists.txt | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) + CMakeLists.txt | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 393fee3..b4f1d26 100644 +index dcc6617..810b329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -38,7 +38,19 @@ endif() +@@ -53,7 +53,21 @@ endif() find_library(AVAHI_CLIENT_LIBRARIES avahi-client) find_library(AVAHI_COMMON_LIBRARIES avahi-common) find_library(PTHREAD_LIBRARIES pthread) -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) ++if(WITH_NETWORK_BACKEND) ++ # 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() +endif() set(LIBIIO_CFILES channel.c device.c context.c buffer.c utilities.c) set(LIBIIO_HEADERS iio.h) -- -2.2.1 +2.2.2