Warning, /frameworks/kdelibs4support/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 # Copyright 2015 Alex Merry <alex.merry@kde.org>
0021 #
0022 # Redistribution and use in source and binary forms, with or without
0023 # modification, are permitted provided that the following conditions
0024 # are met:
0025 # 1. Redistributions of source code must retain the above copyright
0026 #    notice, this list of conditions and the following disclaimer.
0027 # 2. Redistributions in binary form must reproduce the above copyright
0028 #    notice, this list of conditions and the following disclaimer in the
0029 #    documentation and/or other materials provided with the distribution.
0030 # 3. Neither the name of the University nor the names of its contributors
0031 #    may be used to endorse or promote products derived from this software
0032 #    without specific prior written permission.
0033 #
0034 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0035 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0036 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0037 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0038 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0039 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0040 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0041 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0042 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0043 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0044 # SUCH DAMAGE.
0045 
0046 if (NOT PERL_EXECUTABLE)
0047     find_package(Perl)
0048 endif()
0049 
0050 include(FindPackageHandleStandardArgs)
0051 
0052 if (PERL_EXECUTABLE)
0053     set(PerlModules_all_modules_found TRUE)
0054     foreach(_comp ${PerlModules_FIND_COMPONENTS})
0055         execute_process(
0056             COMMAND ${PERL_EXECUTABLE} -e "use ${_comp}"
0057             RESULT_VARIABLE _result
0058             OUTPUT_QUIET
0059             ERROR_QUIET
0060         )
0061         string(REPLACE "::" "_" _comp_sanitised "${_comp}")
0062         if (_result EQUAL 0)
0063             set(PerlModules_${_comp_sanitised}_FOUND TRUE)
0064         else()
0065             set(PerlModules_${_comp_sanitised}_FOUND FALSE)
0066             set(PerlModules_all_modules_found FALSE)
0067         endif()
0068         find_package_handle_standard_args(PerlModules_${_comp}
0069             FOUND_VAR
0070                 PerlModules_${_comp}_FOUND
0071             REQUIRED_VARS
0072                 PerlModules_${_comp_sanitised}_FOUND
0073             )
0074     endforeach()
0075 endif()
0076 
0077 find_package_handle_standard_args(PerlModules
0078     FOUND_VAR
0079         PerlModules_FOUND
0080     REQUIRED_VARS
0081         PerlModules_all_modules_found
0082     HANDLE_COMPONENTS
0083 )
0084 
0085 include(FeatureSummary)
0086 set_package_properties(PerlModules PROPERTIES
0087     URL "http://www.cpan.org"
0088 )
0089