Warning, /frameworks/extra-cmake-modules/find-modules/FindPoppler.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2015 Alex Richardson <arichardson.kde@gmail.com> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 #[=======================================================================[.rst: 0006 FindPoppler 0007 ----------- 0008 0009 Try to find Poppler. 0010 0011 This is a component-based find module, which makes use of the COMPONENTS 0012 and OPTIONAL_COMPONENTS arguments to find_module. The following components 0013 are available:: 0014 0015 Core Cpp Qt5 Qt4 Glib 0016 0017 If no components are specified, this module will act as though all components 0018 were passed to OPTIONAL_COMPONENTS. 0019 0020 This module will define the following variables, independently of the 0021 components searched for or found: 0022 0023 ``Poppler_FOUND`` 0024 TRUE if (the requested version of) Poppler is available 0025 ``Poppler_VERSION`` 0026 Found Poppler version 0027 ``Poppler_TARGETS`` 0028 A list of all targets imported by this module (note that there may be more 0029 than the components that were requested) 0030 ``Poppler_LIBRARIES`` 0031 This can be passed to target_link_libraries() instead of the imported 0032 targets 0033 ``Poppler_INCLUDE_DIRS`` 0034 This should be passed to target_include_directories() if the targets are 0035 not used for linking 0036 ``Poppler_DEFINITIONS`` 0037 This should be passed to target_compile_options() if the targets are not 0038 used for linking 0039 0040 For each searched-for components, ``Poppler_<component>_FOUND`` will be set to 0041 TRUE if the corresponding Poppler library was found, and FALSE otherwise. If 0042 ``Poppler_<component>_FOUND`` is TRUE, the imported target 0043 ``Poppler::<component>`` will be defined. This module will also attempt to 0044 determine ``Poppler_*_VERSION`` variables for each imported target, although 0045 ``Poppler_VERSION`` should normally be sufficient. 0046 0047 In general we recommend using the imported targets, as they are easier to use 0048 and provide more control. Bear in mind, however, that if any target is in the 0049 link interface of an exported library, it must be made available by the 0050 package config file. 0051 0052 Since 5.19 0053 #]=======================================================================] 0054 0055 include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) 0056 0057 ecm_find_package_version_check(Poppler) 0058 0059 set(Poppler_known_components 0060 Cpp 0061 Qt4 0062 Qt5 0063 Qt6 0064 Glib 0065 ) 0066 foreach(_comp ${Poppler_known_components}) 0067 string(TOLOWER "${_comp}" _lc_comp) 0068 set(Poppler_${_comp}_component_deps "Core") 0069 set(Poppler_${_comp}_pkg_config "poppler-${_lc_comp}") 0070 set(Poppler_${_comp}_lib "poppler-${_lc_comp}") 0071 set(Poppler_${_comp}_header_subdir "poppler/${_lc_comp}") 0072 endforeach() 0073 set(Poppler_known_components Core ${Poppler_known_components}) 0074 0075 set(Poppler_Core_component_deps "") 0076 set(Poppler_Core_pkg_config "poppler") 0077 # poppler-config.h header is only installed with --enable-xpdf-headers 0078 # fall back to using any header from a submodule with a path to make it work in that case too 0079 set(Poppler_Core_header "poppler-config.h" "cpp/poppler-version.h" "qt6/poppler-qt6.h" "qt5/poppler-qt5.h" "qt4/poppler-qt4.h" "glib/poppler.h") 0080 set(Poppler_Core_header_subdir "poppler") 0081 set(Poppler_Core_lib "poppler") 0082 0083 set(Poppler_Cpp_header "poppler-version.h") 0084 set(Poppler_Qt6_header "poppler-qt6.h") 0085 set(Poppler_Qt5_header "poppler-qt5.h") 0086 set(Poppler_Qt4_header "poppler-qt4.h") 0087 set(Poppler_Glib_header "poppler.h") 0088 0089 ecm_find_package_parse_components(Poppler 0090 RESULT_VAR Poppler_components 0091 KNOWN_COMPONENTS ${Poppler_known_components} 0092 ) 0093 ecm_find_package_handle_library_components(Poppler 0094 COMPONENTS ${Poppler_components} 0095 ) 0096 0097 # If pkg-config didn't provide us with version information, 0098 # try to extract it from poppler-version.h or poppler-config.h 0099 if(NOT Poppler_VERSION) 0100 find_file(Poppler_VERSION_HEADER 0101 NAMES "poppler-config.h" "cpp/poppler-version.h" 0102 HINTS ${Poppler_INCLUDE_DIRS} 0103 PATH_SUFFIXES ${Poppler_Core_header_subdir} 0104 ) 0105 mark_as_advanced(Poppler_VERSION_HEADER) 0106 if(Poppler_VERSION_HEADER) 0107 file(READ ${Poppler_VERSION_HEADER} _poppler_version_header_contents) 0108 string(REGEX REPLACE 0109 "^.*[ \t]+POPPLER_VERSION[ \t]+\"([0-9d.]*)\".*$" 0110 "\\1" 0111 Poppler_VERSION 0112 "${_poppler_version_header_contents}" 0113 ) 0114 unset(_poppler_version_header_contents) 0115 endif() 0116 endif() 0117 0118 find_package_handle_standard_args(Poppler 0119 FOUND_VAR 0120 Poppler_FOUND 0121 REQUIRED_VARS 0122 Poppler_LIBRARIES 0123 VERSION_VAR 0124 Poppler_VERSION 0125 HANDLE_COMPONENTS 0126 ) 0127 0128 include(FeatureSummary) 0129 set_package_properties(Poppler PROPERTIES 0130 DESCRIPTION "A PDF rendering library" 0131 URL "https://poppler.freedesktop.org/" 0132 )