1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-21 23:00:50 +08:00

FindTclsh: Add Tclsh_VERSION

This deprecates the TCLSH_VERSION_STRING result variable.

Issue: #27088
This commit is contained in:
Peter Kokot
2025-08-22 23:10:09 +02:00
parent 492a531e8a
commit f9fec08e69
4 changed files with 36 additions and 11 deletions

View File

@@ -99,6 +99,9 @@ Find Modules
result variable. The ``Subversion_VERSION_SVN`` result variable is result variable. The ``Subversion_VERSION_SVN`` result variable is
deprecated. deprecated.
* The :module:`FindTclsh` module now provides a ``Tclsh_VERSION`` result
variable. The ``TCLSH_VERSION_STRING`` result variable is deprecated.
* The :module:`FindTIFF` module now provides a ``TIFF_VERSION`` result * The :module:`FindTIFF` module now provides a ``TIFF_VERSION`` result
variable. The ``TIFF_VERSION_STRING`` result variable is deprecated. variable. The ``TIFF_VERSION_STRING`` result variable is deprecated.

View File

@@ -79,8 +79,8 @@ endblock()
include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindWish.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindWish.cmake)
if(TCLSH_VERSION_STRING) if(Tclsh_VERSION)
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}") set(TCL_TCLSH_VERSION "${Tclsh_VERSION}")
else() else()
get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH) get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH) get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)

View File

@@ -10,7 +10,7 @@ Finds the Tcl shell command-line executable (``tclsh``), which includes the Tcl
.. code-block:: cmake .. code-block:: cmake
find_package(Tclsh [...]) find_package(Tclsh [<version>] [...])
Result Variables Result Variables
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
@@ -18,9 +18,14 @@ Result Variables
This module defines the following variables: This module defines the following variables:
``Tclsh_FOUND`` ``Tclsh_FOUND``
Boolean indicating whether the ``tclsh`` executable (and the requested Boolean indicating whether the (requested version of) ``tclsh`` executable
version, if specified) is found. For backward compatibility, the is found. For backward compatibility, the ``TCLSH_FOUND`` variable is
``TCLSH_FOUND`` variable is also set to the same value. also set to the same value.
``Tclsh_VERSION``
.. versionadded:: 4.2
The version of ``tclsh`` found.
Cache Variables Cache Variables
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
@@ -30,14 +35,30 @@ The following cache variables may also be set:
``TCL_TCLSH`` ``TCL_TCLSH``
The path to the ``tclsh`` executable. The path to the ``tclsh`` executable.
Deprecated Variables
^^^^^^^^^^^^^^^^^^^^
The following variables are provided for backward compatibility:
``TCLSH_VERSION_STRING``
.. deprecated:: 4.2
Use ``Tclsh_VERSION``, which has the same value.
The version of ``tclsh`` found.
Examples Examples
^^^^^^^^ ^^^^^^^^
Finding the ``tclsh`` command-line executable: In the following example, this module is used to find the ``tclsh``
command-line executable, which is then executed in a process to evaluate
TCL code from the script file located in the project source directory:
.. code-block:: cmake .. code-block:: cmake
find_package(Tclsh) find_package(Tclsh)
if(Tclsh_FOUND)
execute_process(COMMAND ${TCL_TCLSH} example-script.tcl)
endif()
See Also See Also
^^^^^^^^ ^^^^^^^^
@@ -108,9 +129,10 @@ find_program(TCL_TCLSH
if(TCL_TCLSH) if(TCL_TCLSH)
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version" execute_process(COMMAND "${CMAKE_COMMAND}" -E echo puts "\$tcl_version"
COMMAND "${TCL_TCLSH}" COMMAND "${TCL_TCLSH}"
OUTPUT_VARIABLE TCLSH_VERSION_STRING OUTPUT_VARIABLE Tclsh_VERSION
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
set(TCLSH_VERSION_STRING "${Tclsh_VERSION}")
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
@@ -124,7 +146,7 @@ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "TCL" OR
endif () endif ()
find_package_handle_standard_args(Tclsh find_package_handle_standard_args(Tclsh
REQUIRED_VARS TCL_TCLSH REQUIRED_VARS TCL_TCLSH
VERSION_VAR TCLSH_VERSION_STRING) VERSION_VAR Tclsh_VERSION)
unset(FPHSA_NAME_MISMATCHED) unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(TCL_TCLSH) mark_as_advanced(TCL_TCLSH)

View File

@@ -104,7 +104,7 @@ foreach(
LIBLZMA LIBXML2 LIBXSLT LTTNGUST LIBLZMA LIBXML2 LIBXSLT LTTNGUST
PERL PKG_CONFIG PNG PostgreSQL PERL PKG_CONFIG PNG PostgreSQL
SDL SDL
TIFF TCLSH TIFF
wxWidgets wxWidgets
ZLIB ZLIB
) )
@@ -127,7 +127,7 @@ foreach(
Perl PerlLibs PkgConfig PNG PostgreSQL Protobuf Perl PerlLibs PkgConfig PNG PostgreSQL Protobuf
Ruby RUBY Ruby RUBY
SDL SWIG SDL SWIG
TIFF Tclsh TIFF
wxWidgets wxWidgets
ZLIB ZLIB
) )