Git commit 1d7cc038328aa99d51c6d16f973f8a00be8f471c by Alex Merry, on behal= f of Aleix Pol. Committed on 04/09/2013 at 14:45. Pushed by ltoscano into branch 'master'. Move FindDocBook* to find-modules Originally commit d42d5889d25ac4c900a294f283dd802eccf96010 of the extra-cmake-modules repository Commit de7d80c720851a8eead8f8e84f3ce73f46beb437 in kdoctools A +59 -0 cmake/FindDocBookXML.cmake http://commits.kde.org/kde4support/1d7cc038328aa99d51c6d16f973f8a00be8f471c diff --git a/cmake/FindDocBookXML.cmake b/cmake/FindDocBookXML.cmake new file mode 100644 index 0000000..b59d209 --- /dev/null +++ b/cmake/FindDocBookXML.cmake @@ -0,0 +1,59 @@ +# Try to find DocBook XML DTDs +# Once done, it will define: +# +# DocBookXML_FOUND - system has the required DocBook XML DTDs +# DocBookXML_CURRENTDTD_VERSION - the version of currently used DocBook X= ML +# DTD +# DocBookXML_CURRENTDTD_DIR - the directory containing the definition of +# the currently used DocBook XML version + +# Copyright (c) 2010, Luigi Toscano, +# +# Redistribution and use is allowed according to the terms of the BSD lice= nse. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +set (DocBookXML_CURRENTDTD_VERSION "4.2" + CACHE INTERNAL "Required version of XML DTDs") + +set (DTD_PATH_LIST + share/xml/docbook/schema/dtd/${DocBookXML_CURRENTDTD_VERSION} + share/xml/docbook/xml-dtd-${DocBookXML_CURRENTDTD_VERSION} + share/sgml/docbook/xml-dtd-${DocBookXML_CURRENTDTD_VERSION} + share/xml/docbook/${DocBookXML_CURRENTDTD_VERSION} +) + +find_path (DocBookXML_CURRENTDTD_DIR docbookx.dtd + PATHS ${CMAKE_SYSTEM_PREFIX_PATH} + PATH_SUFFIXES ${DTD_PATH_LIST} +) + +if (NOT DocBookXML_CURRENTDTD_DIR) + # hacks for systems that use the package version in the DTD dirs, + # e.g. Fedora, OpenSolaris + set (DTD_PATH_LIST) + foreach (DTD_PREFIX_ITER ${CMAKE_SYSTEM_PREFIX_PATH}) + file(GLOB DTD_SUFFIX_ITER RELATIVE ${DTD_PREFIX_ITER} + ${DTD_PREFIX_ITER}/share/sgml/docbook/xml-dtd-${DocBookXML_CUR= RENTDTD_VERSION}-* + ) + if (DTD_SUFFIX_ITER) + list (APPEND DTD_PATH_LIST ${DTD_SUFFIX_ITER}) + endif () + endforeach () + + find_path (DocBookXML_CURRENTDTD_DIR docbookx.dtd + PATHS ${CMAKE_SYSTEM_PREFIX_PATH} + PATH_SUFFIXES ${DTD_PATH_LIST} + ) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args (DocBookXML + "Could NOT find DocBook XML DTDs (v${DocBookXML_CURRENTDTD_VERSION})" + DocBookXML_CURRENTDTD_DIR DocBookXML_CURRENTDTD_VERSION) + +#maintain backwards compatibility +set(DOCBOOKXML_FOUND ${DocBookXML_FOUND}) +set(DOCBOOKXML_CURRENTDTD_DIR ${DocBookXML_CURRENTDTD_DIR}) +set(DOCBOOKXML_CURRENTDTD_VERSION ${DocBookXML_CURRENTDTD_VERSION}) + +mark_as_advanced (DocBookXML_CURRENTDTD_DIR DocBookXML_CURRENTDTD_VERSION)