mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 11:49:55 -06:00
FindPerl, FindPerlLibs: Add Perl_VERSION and PerlLibs_VERSION
This deprecates the PERL_VERSION_STRING result variable. Issue: #27088
This commit is contained in:
@@ -53,6 +53,12 @@ Find Modules
|
||||
* The :module:`FindOpenSSL` module now provides an ``OpenSSL_VERSION`` result
|
||||
variable. The ``OPENSSL_VERSION`` result variable is deprecated.
|
||||
|
||||
* The :module:`FindPerl` module now provides a ``Perl_VERSION`` result
|
||||
variable. The ``PERL_VERSION_STRING`` result variable is deprecated.
|
||||
|
||||
* The :module:`FindPerlLibs` module now provides a ``PerlLibs_VERSION``
|
||||
result variable.
|
||||
|
||||
* The :module:`FindPNG` module now provides a ``PNG_VERSION`` result
|
||||
variable. The ``PNG_VERSION_STRING`` result variable is deprecated.
|
||||
|
||||
|
||||
@@ -5,8 +5,13 @@
|
||||
FindPerl
|
||||
--------
|
||||
|
||||
Finds a Perl interpreter. Perl is a general-purpose, interpreted, dynamic
|
||||
programming language.
|
||||
Finds a Perl interpreter:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(Perl [<version>] [...])
|
||||
|
||||
Perl is a general-purpose, interpreted, dynamic programming language.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -14,10 +19,13 @@ Result Variables
|
||||
This module defines the following variables:
|
||||
|
||||
``Perl_FOUND``
|
||||
True if the Perl executable was found. For backward compatibility, the
|
||||
``PERL_FOUND`` variable is also set to the same value.
|
||||
Boolean indicating whether the (requested version of) Perl executable is
|
||||
found. For backward compatibility, the ``PERL_FOUND`` variable is also
|
||||
set to the same value.
|
||||
|
||||
``Perl_VERSION``
|
||||
.. versionadded:: 4.2
|
||||
|
||||
``PERL_VERSION_STRING``
|
||||
The version of Perl found.
|
||||
|
||||
Cache Variables
|
||||
@@ -28,14 +36,34 @@ The following cache variables may also be set:
|
||||
``PERL_EXECUTABLE``
|
||||
Full path to the ``perl`` executable.
|
||||
|
||||
Deprecated Variables
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following variables are provided for backward compatibility:
|
||||
|
||||
``PERL_VERSION_STRING``
|
||||
.. deprecated:: 4.2
|
||||
Superseded by the ``Perl_VERSION``.
|
||||
|
||||
The version of Perl found.
|
||||
|
||||
Examples
|
||||
^^^^^^^^
|
||||
|
||||
Finding the Perl interpreter:
|
||||
Finding the Perl interpreter and executing it in a process:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(Perl)
|
||||
|
||||
if(Perl_FOUND)
|
||||
execute_process(COMMAND ${PERL_EXECUTABLE} --help)
|
||||
endif()
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
* The :module:`FindPerlLibs` to find Perl libraries.
|
||||
#]=======================================================================]
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
|
||||
@@ -64,7 +92,6 @@ find_program(PERL_EXECUTABLE
|
||||
)
|
||||
|
||||
if(PERL_EXECUTABLE)
|
||||
### PERL_VERSION
|
||||
execute_process(
|
||||
COMMAND
|
||||
${PERL_EXECUTABLE} -V:version
|
||||
@@ -76,7 +103,8 @@ if(PERL_EXECUTABLE)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'")
|
||||
string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE})
|
||||
string(REGEX REPLACE "version='([^']+)'.*" "\\1" Perl_VERSION ${PERL_VERSION_OUTPUT_VARIABLE})
|
||||
set(PERL_VERSION_STRING "${Perl_VERSION}")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${PERL_EXECUTABLE} -v
|
||||
@@ -86,9 +114,11 @@ if(PERL_EXECUTABLE)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]")
|
||||
set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||
set(Perl_VERSION "${CMAKE_MATCH_1}")
|
||||
set(PERL_VERSION_STRING "${Perl_VERSION}")
|
||||
elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +")
|
||||
set(PERL_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||
set(Perl_VERSION "${CMAKE_MATCH_1}")
|
||||
set(PERL_VERSION_STRING "${Perl_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -105,7 +135,7 @@ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "PerlLibs")
|
||||
endif ()
|
||||
find_package_handle_standard_args(Perl
|
||||
REQUIRED_VARS PERL_EXECUTABLE
|
||||
VERSION_VAR PERL_VERSION_STRING)
|
||||
VERSION_VAR Perl_VERSION)
|
||||
unset(FPHSA_NAME_MISMATCHED)
|
||||
|
||||
mark_as_advanced(PERL_EXECUTABLE)
|
||||
|
||||
@@ -5,18 +5,33 @@
|
||||
FindPerlLibs
|
||||
------------
|
||||
|
||||
Finds Perl libraries. Perl is a general-purpose, interpreted, dynamic
|
||||
programming language. This module detects whether Perl is installed and
|
||||
determines the locations of include paths, libraries, and the library name.
|
||||
Finds Perl libraries:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(PerlLibs [<version>] [...])
|
||||
|
||||
Perl is a general-purpose, interpreted, dynamic programming language.
|
||||
|
||||
This module detects whether Perl interpreter is installed via the
|
||||
:module:`FindPerl` module and determines the locations of Perl include paths,
|
||||
libraries, and the library name.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module sets the following variables:
|
||||
This module defines the following variables:
|
||||
|
||||
``PerlLibs_FOUND``
|
||||
True if ``perl.h`` and ``libperl`` were found. For backward compatibility,
|
||||
the ``PERLLIBS_FOUND`` variable is also set to the same value.
|
||||
Boolean indicating whether the (requested version of) Perl library
|
||||
(``perl.h`` and ``libperl``) is found. For backward compatibility, the
|
||||
``PERLLIBS_FOUND`` variable is also set to the same value.
|
||||
|
||||
``PerlLibs_VERSION``
|
||||
.. versionadded:: 4.2
|
||||
|
||||
The version of Perl library found.
|
||||
|
||||
``PERL_SITESEARCH``
|
||||
Path to the sitesearch install directory (``-V:installsitesearch``).
|
||||
``PERL_SITEARCH``
|
||||
@@ -58,11 +73,18 @@ Finding Perl libraries and specifying the minimum required version:
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(PerlLibs 6.0)
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
* The :module:`FindPerl` module to find the Perl interpreter.
|
||||
#]=======================================================================]
|
||||
|
||||
# find the perl executable
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake)
|
||||
|
||||
set(PerlLibs_VERSION "${Perl_VERSION}")
|
||||
|
||||
if (PERL_EXECUTABLE)
|
||||
|
||||
function (perl_get_info _pgi_info tag)
|
||||
@@ -122,10 +144,10 @@ if (PERL_EXECUTABLE)
|
||||
### PERL_POSSIBLE_LIBRARY_NAMES
|
||||
perl_get_info(PERL_POSSIBLE_LIBRARY_NAMES libperl)
|
||||
if (NOT PERL_POSSIBLE_LIBRARY_NAMES)
|
||||
set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl)
|
||||
set(PERL_POSSIBLE_LIBRARY_NAMES perl${PerlLibs_VERSION} perl)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
|
||||
list (APPEND PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING})
|
||||
list (APPEND PERL_POSSIBLE_LIBRARY_NAMES perl${PerlLibs_VERSION})
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "MSYS|CYGWIN")
|
||||
# On MSYS and CYGWIN environments, current perl -V:libperl gives shared
|
||||
@@ -141,10 +163,10 @@ if (PERL_EXECUTABLE)
|
||||
PATHS
|
||||
"${PERL_UPDATE_ARCHLIB}/CORE"
|
||||
"${PERL_ARCHLIB}/CORE"
|
||||
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
|
||||
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
|
||||
/usr/lib/perl5/${PerlLibs_VERSION}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl/${PerlLibs_VERSION}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl5/${PerlLibs_VERSION}/CORE
|
||||
/usr/lib/perl/${PerlLibs_VERSION}/CORE
|
||||
)
|
||||
|
||||
### PERL_LIBRARY
|
||||
@@ -154,24 +176,24 @@ if (PERL_EXECUTABLE)
|
||||
PATHS
|
||||
"${PERL_UPDATE_ARCHLIB}/CORE"
|
||||
"${PERL_ARCHLIB}/CORE"
|
||||
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
|
||||
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
|
||||
/usr/lib/perl5/${PerlLibs_VERSION}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl/${PerlLibs_VERSION}/${PERL_ARCHNAME}/CORE
|
||||
/usr/lib/perl5/${PerlLibs_VERSION}/CORE
|
||||
/usr/lib/perl/${PerlLibs_VERSION}/CORE
|
||||
)
|
||||
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
|
||||
VERSION_VAR PERL_VERSION_STRING)
|
||||
VERSION_VAR PerlLibs_VERSION)
|
||||
|
||||
# Introduced after CMake 2.6.4 to bring module into compliance
|
||||
set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH})
|
||||
set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH})
|
||||
set(PERL_LIBRARIES ${PERL_LIBRARY})
|
||||
# For backward compatibility with CMake before 2.8.8
|
||||
set(PERL_VERSION ${PERL_VERSION_STRING})
|
||||
set(PERL_VERSION ${PerlLibs_VERSION})
|
||||
|
||||
mark_as_advanced(
|
||||
PERL_INCLUDE_PATH
|
||||
|
||||
@@ -123,7 +123,7 @@ foreach(
|
||||
Jasper JPEG
|
||||
LibArchive LibLZMA LIBLZMA LibXml2 LibXslt LTTngUST
|
||||
OpenSceneGraph OPENSCENEGRAPH OpenSSL OPENSSL
|
||||
PNG PostgreSQL Protobuf
|
||||
Perl PerlLibs PNG PostgreSQL Protobuf
|
||||
Ruby RUBY
|
||||
SDL SWIG
|
||||
TIFF
|
||||
|
||||
Reference in New Issue
Block a user