From 204070068def4e96a9207444c445225ee94bf16c Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Sun, 17 Aug 2014 12:58:16 +0100 Subject: FindXerces: New module to find Apache Xerces-C++ --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindXerces.rst | 1 + Modules/FindXerces.cmake | 85 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 Help/module/FindXerces.rst create mode 100644 Modules/FindXerces.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index c279d50..a00479d 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -207,6 +207,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows + /module/FindXerces /module/FindX11 /module/FindXMLRPC /module/FindZLIB diff --git a/Help/module/FindXerces.rst b/Help/module/FindXerces.rst new file mode 100644 index 0000000..166d8dd --- /dev/null +++ b/Help/module/FindXerces.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXerces.cmake diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake new file mode 100644 index 0000000..325bb6d --- /dev/null +++ b/Modules/FindXerces.cmake @@ -0,0 +1,85 @@ +#.rst: +# FindXerces +# ---------- +# +# Find the Apache Xerces-C++ validating XML parser headers and libraries. +# +# This module reports information about the Xerces installation in +# several variables. General variables:: +# +# Xerces_FOUND - true if the Xerces headers and libraries were found +# Xerces_VERSION - Xerces release version +# Xerces_INCLUDE_DIRS - the directory containing the Xerces headers +# Xerces_LIBRARIES - Xerces libraries to be linked +# +# The following cache variables may also be set:: +# +# Xerces_INCLUDE_DIR - the directory containing the Xerces headers +# Xerces_LIBRARY - the Xerces library + +# Written by Roger Leigh + +#============================================================================= +# Copyright 2014 University of Dundee +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_Xerces_GET_VERSION version_hdr) + file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*") + if(_contents) + string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Xerces_MAJOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Xerces_MINOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" Xerces_PATCH "${_contents}") + + if(NOT Xerces_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!") + endif() + if(NOT Xerces_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!") + endif() + if(NOT Xerces_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!") + endif() + + set(Xerces_VERSION "${Xerces_MAJOR}.${Xerces_MINOR}.${Xerces_PATCH}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") + endif() +endfunction() + +# Find include directory +find_path(Xerces_INCLUDE_DIR + NAMES "xercesc/util/PlatformUtils.hpp" + DOC "Xerces-C++ include directory") +mark_as_advanced(Xerces_INCLUDE_DIR) + +# Find all Xerces libraries +find_library(Xerces_LIBRARY "xerces-c" + DOC "Xerces-C++ libraries") +mark_as_advanced(Xerces_LIBRARY) + +if(Xerces_INCLUDE_DIR) + _Xerces_GET_VERSION("${Xerces_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xerces + FOUND_VAR Xerces_FOUND + REQUIRED_VARS Xerces_LIBRARY + Xerces_INCLUDE_DIR + Xerces_VERSION + VERSION_VAR Xerces_VERSION + FAIL_MESSAGE "Failed to find Xerces") + +if(Xerces_FOUND) + set(Xerces_INCLUDE_DIRS "${Xerces_INCLUDE_DIR}") + set(Xerces_LIBRARIES "${Xerces_LIBRARY}") +endif() -- cgit v0.12 ge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integ...Qt Continuous Integration System2011-03-281-3/+2 |\ \ | |/ |/| | * directfb: avoid version dependency by setting DSPD_DST blend functions manuallyDenis Oliver Kropp2011-03-281-3/+2 * | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integ...Qt Continuous Integration System2011-03-232-10/+13 |\ \ | |/ | * Fixes QT-4753Xizhi Zhu2011-03-232-10/+13 * | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integr...Qt Continuous Integration System2011-03-222-4/+0 |\ \ | |/ |/| | * Remove useless profile reference.axis2011-03-222-4/+0 * | Merge remote-tracking branch 'mainline/4.7' into 4.7Oswald Buddenhagen2011-03-213-15/+225 |\ \ | * \ Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integ...Qt Continuous Integration System2011-03-182-6/+19 | |\ \ | | * | Added setSwitchPolicy to MeeGo graphicssystem helper API.Samuel Rødal2011-03-182-6/+19 | * | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integ...Qt Continuous Integration System2011-03-171-1/+38 | |\ \ \ | | |/ / | | * | Switch to raster also when last window is destroyed (on MeeGo).Samuel Rødal2011-03-171-1/+38 | * | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integ...Qt Continuous Integration System2011-03-163-15/+175 | |\ \ \ | | |/ / | | * | QMeeGoLivePixmapData : when creating QImage, use constructor with pitch.Tapani Pälli2011-03-161-1/+1 | | * | Added automatic graphicssystem switching on meego when app is minimized.Samuel Rødal2011-03-162-14/+174 * | | | Bump Qt version to 4.7.4Timo Turunen2011-03-211-1/+1 |/ / / * | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integr...Qt Continuous Integration System2011-03-151-2/+14 |\ \ \ | | |/ | |/| | * | Merge branch 'backporting-symbian-armcc-to-4.7' into s60-4.7axis2011-03-141-2/+14 | |\ \ | | * | Fixed a build library deployment issue in sqlite.axis2011-03-041-0/+6 | | * | Changed various qmake constructs to support Windows.axis2011-02-181-2/+8 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integr...Qt Continuous Integration System2011-03-101-5/+7 |\ \ \ \ | |/ / / | * | | Don't use EGL surfaces for translucency with 32MB GPU chip.Jani Hautakangas2011-03-101-5/+7 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integ...Qt Continuous Integration System2011-03-101-1/+1 |\ \ \ \ | |/ / / |/| | | | * | | Bump Qt version to 4.7.3Timo Turunen2011-03-091-1/+1 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integ...Qt Continuous Integration System2011-03-081-6/+6 |\ \ \ \ | |/ / / | * | | Fix possible bearer management Crash with Panic E32USER-CBase, 69Cristiano di Flora2011-03-081-6/+5 | * | | Unsuccessful unlocking of QNetworkConfigurationPrivate mutexPerttu Pohjonen2011-03-071-0/+1 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integ...Qt Continuous Integration System2011-03-074-0/+34 |\ \ \ \ | | |_|/ | |/| | | * | | Invalidate the EGL surface of QMeeGoLivePixmapData when switching to RasterPauli Nieminen2011-03-074-0/+34 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integ...Qt Continuous Integration System2011-03-041-1/+1 |\ \ \ \ | |/ / / | * | | Added image conversion flag to prevent conversions.Samuel Rødal2011-03-041-1/+1 * | | | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7Laszlo Agocs2011-03-01