From 27141eede739fb4376a6fe2cec1b1171841bf7fb Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Dec 2014 10:36:21 -0500 Subject: Modules: Rename FindXerces to FindXercesC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The FindXerces module was added in commit v3.1.0-rc1~155^2 (FindXerces: New module to find Apache Xerces-C++, 2014-08-17). However, there are two implementations of Xerces, one in C++: http://xerces.apache.org/xerces-c/ and one in Java: http://xerces.apache.org/xerces-j/ Rename FindXerces to FindXercesC to clarify that it is about the C++ implementation. While at it, add the missing CMake 3.1 release note about this module. Suggested-by: Erik Sjölund --- Help/manual/cmake-modules.7.rst | 2 +- Help/module/FindXerces.rst | 1 - Help/module/FindXercesC.rst | 1 + Help/release/3.1.0.rst | 2 + Modules/FindXerces.cmake | 85 ----------------------------------------- Modules/FindXercesC.cmake | 85 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 89 insertions(+), 87 deletions(-) delete mode 100644 Help/module/FindXerces.rst create mode 100644 Help/module/FindXercesC.rst delete mode 100644 Modules/FindXerces.cmake create mode 100644 Modules/FindXercesC.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index f5a35b3..201c95f 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -208,7 +208,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows - /module/FindXerces + /module/FindXercesC /module/FindX11 /module/FindXMLRPC /module/FindZLIB diff --git a/Help/module/FindXerces.rst b/Help/module/FindXerces.rst deleted file mode 100644 index 166d8dd..0000000 --- a/Help/module/FindXerces.rst +++ /dev/null @@ -1 +0,0 @@ -.. cmake-module:: ../../Modules/FindXerces.cmake diff --git a/Help/module/FindXercesC.rst b/Help/module/FindXercesC.rst new file mode 100644 index 0000000..4818071 --- /dev/null +++ b/Help/module/FindXercesC.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXercesC.cmake diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst index 65aae00..0cece37 100644 --- a/Help/release/3.1.0.rst +++ b/Help/release/3.1.0.rst @@ -238,6 +238,8 @@ Modules * The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG`` environment variable value as the ``pkg-config`` executable, if set. +* The :module:`FindXercesC` module was introduced. + * The :module:`FindZLIB` module now provides imported targets. * The :module:`GenerateExportHeader` module ``generate_export_header`` diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake deleted file mode 100644 index 6c6007a..0000000 --- a/Modules/FindXerces.cmake +++ /dev/null @@ -1,85 +0,0 @@ -#.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(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -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() diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake new file mode 100644 index 0000000..5a8ea9d --- /dev/null +++ b/Modules/FindXercesC.cmake @@ -0,0 +1,85 @@ +#.rst: +# FindXercesC +# ----------- +# +# Find the Apache Xerces-C++ validating XML parser headers and libraries. +# +# This module reports information about the Xerces installation in +# several variables. General variables:: +# +# XercesC_FOUND - true if the Xerces headers and libraries were found +# XercesC_VERSION - Xerces release version +# XercesC_INCLUDE_DIRS - the directory containing the Xerces headers +# XercesC_LIBRARIES - Xerces libraries to be linked +# +# The following cache variables may also be set:: +# +# XercesC_INCLUDE_DIR - the directory containing the Xerces headers +# XercesC_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(_XercesC_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" XercesC_MAJOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XercesC_MINOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XercesC_PATCH "${_contents}") + + if(NOT XercesC_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!") + endif() + if(NOT XercesC_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!") + endif() + if(NOT XercesC_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!") + endif() + + set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_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(XercesC_INCLUDE_DIR + NAMES "xercesc/util/PlatformUtils.hpp" + DOC "Xerces-C++ include directory") +mark_as_advanced(XercesC_INCLUDE_DIR) + +# Find all XercesC libraries +find_library(XercesC_LIBRARY "xerces-c" + DOC "Xerces-C++ libraries") +mark_as_advanced(XercesC_LIBRARY) + +if(XercesC_INCLUDE_DIR) + _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC + FOUND_VAR XercesC_FOUND + REQUIRED_VARS XercesC_LIBRARY + XercesC_INCLUDE_DIR + XercesC_VERSION + VERSION_VAR XercesC_VERSION + FAIL_MESSAGE "Failed to find XercesC") + +if(XercesC_FOUND) + set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}") + set(XercesC_LIBRARIES "${XercesC_LIBRARY}") +endif() -- cgit v0.12