Warning, /frameworks/kdelibs4support/cmake/FindDocBookXML4.cmake is written in an unsupported language. File is not indexed.

0001 # Try to find DocBook XML 4.x DTD.
0002 # By default it will find version 4.2. A different version can be specified
0003 # as parameter for find_package().
0004 # Once done, it will define:
0005 #
0006 #  DocBookXML4_FOUND - system has the requested DocBook4 XML DTDs
0007 #  DocBookXML4_DTD_VERSION - the version of requested DocBook4
0008 #     XML DTD
0009 #  DocBookXML4_DTD_DIR - the directory containing the definition of
0010 #     the DocBook4 XML
0011 
0012 # Copyright (c) 2010, 2014 Luigi Toscano, <luigi.toscano@tiscali.it>
0013 #
0014 # Redistribution and use is allowed according to the terms of the BSD license.
0015 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0016 
0017 
0018 if (NOT DocBookXML_FIND_VERSION)
0019      set(DocBookXML_FIND_VERSION "4.2")
0020 endif ()
0021 
0022 set (DocBookXML4_DTD_VERSION ${DocBookXML_FIND_VERSION}
0023      CACHE INTERNAL "Required version of DocBook4 XML DTDs")
0024 
0025 include(FeatureSummary)
0026 set_package_properties(DocBookXML4 PROPERTIES DESCRIPTION "DocBook XML 4"
0027                        URL "http://www.oasis-open.org/docbook/xml/${DocBookXML4_DTD_VERSION}"
0028                       )
0029 
0030 function (locate_version version found_dir)
0031 
0032     set (DTD_PATH_LIST
0033         share/xml/docbook/schema/dtd/${version}
0034         share/xml/docbook/xml-dtd-${version}
0035         share/sgml/docbook/xml-dtd-${version}
0036         share/xml/docbook/${version}
0037     )
0038 
0039     find_path (searched_dir docbookx.dtd
0040         PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
0041         PATH_SUFFIXES ${DTD_PATH_LIST}
0042     )
0043 
0044     if (NOT searched_dir)
0045         # hacks for systems that use the package version in the DTD dirs,
0046         # e.g. Fedora, OpenSolaris
0047         set (DTD_PATH_LIST)
0048         foreach (DTD_PREFIX_ITER ${CMAKE_SYSTEM_PREFIX_PATH})
0049             file(GLOB DTD_SUFFIX_ITER RELATIVE ${DTD_PREFIX_ITER}
0050                 ${DTD_PREFIX_ITER}/share/sgml/docbook/xml-dtd-${version}-*
0051             )
0052             if (DTD_SUFFIX_ITER)
0053                 list (APPEND DTD_PATH_LIST ${DTD_SUFFIX_ITER})
0054             endif ()
0055         endforeach ()
0056 
0057         find_path (searched_dir docbookx.dtd
0058             PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
0059             PATH_SUFFIXES ${DTD_PATH_LIST}
0060         )
0061     endif ()
0062     set (${found_dir} ${searched_dir} PARENT_SCOPE)
0063 endfunction()
0064 
0065 
0066 locate_version (${DocBookXML4_DTD_VERSION} DocBookXML4_DTD_DIR)
0067 
0068 include(FindPackageHandleStandardArgs)
0069 find_package_handle_standard_args (DocBookXML4
0070     REQUIRED_VARS DocBookXML4_DTD_DIR DocBookXML4_DTD_VERSION
0071     FOUND_VAR DocBookXML4_FOUND)
0072 
0073 mark_as_advanced (DocBookXML4_DTD_DIR DocBookXML4_DTD_VERSION)