Warning, /frameworks/kdoctools/cmake/FindPerlModules.cmake is written in an unsupported language. File is not indexed.
0001 #.rst:
0002 # FindPerlModules
0003 # ---------------
0004 #
0005 # Check that Perl has certain modules available.
0006 #
0007 # If PERL_EXECUTABLE is set, uses that, otherwise calls the Perl find module.
0008 #
0009 # To use, pass the perl module names (in the form you would use in a Perl
0010 # ``use`` statement) as components.
0011 #
0012 # This will define the following variables:
0013 #
0014 # ``Perl_<module>_FOUND``
0015 # True if the given Perl module could be loaded by Perl
0016 #
0017 # where ``<module>`` is either the name passed as a component, or a version
0018 # with ``::`` replaced by ``_``.
0019
0020 # SPDX-FileCopyrightText: 2015 Alex Merry <alex.merry@kde.org>
0021 #
0022 # SPDX-License-Identifier: BSD-3-Clause
0023
0024 if (NOT PERL_EXECUTABLE)
0025 find_package(Perl)
0026 endif()
0027
0028 include(FindPackageHandleStandardArgs)
0029
0030 if (PERL_EXECUTABLE)
0031 set(PerlModules_all_modules_found TRUE)
0032 foreach(_comp ${PerlModules_FIND_COMPONENTS})
0033 execute_process(
0034 COMMAND ${PERL_EXECUTABLE} -e "use ${_comp}"
0035 RESULT_VARIABLE _result
0036 OUTPUT_QUIET
0037 ERROR_QUIET
0038 )
0039 string(REPLACE "::" "_" _comp_sanitised "${_comp}")
0040 if (_result EQUAL 0)
0041 set(PerlModules_${_comp_sanitised}_FOUND TRUE)
0042 else()
0043 set(PerlModules_${_comp_sanitised}_FOUND FALSE)
0044 set(PerlModules_all_modules_found FALSE)
0045 endif()
0046 find_package_handle_standard_args(PerlModules_${_comp}
0047 FOUND_VAR
0048 PerlModules_${_comp}_FOUND
0049 REQUIRED_VARS
0050 PerlModules_${_comp_sanitised}_FOUND
0051 )
0052 endforeach()
0053 endif()
0054
0055 find_package_handle_standard_args(PerlModules
0056 FOUND_VAR
0057 PerlModules_FOUND
0058 REQUIRED_VARS
0059 PerlModules_all_modules_found
0060 HANDLE_COMPONENTS
0061 )
0062
0063 include(FeatureSummary)
0064 set_package_properties(PerlModules PROPERTIES
0065 URL "https://www.cpan.org"
0066 )
0067