FindIcotool: Add Icotool_VERSION

This deprecates the ICOTOOL_VERSION_STRING result variable.

Issue: #27088
This commit is contained in:
Peter Kokot
2025-08-20 23:05:52 +02:00
parent f503c8dad4
commit f0b4c19052
3 changed files with 28 additions and 13 deletions

View File

@@ -40,6 +40,9 @@ Find Modules
* The :module:`FindHSPELL` module now provides a ``HSPELL_VERSION`` result
variable. The ``HSPELL_VERSION_STRING`` result variable is deprecated.
* The :module:`FindIcotool` module now provides a ``Icotool_VERSION`` result
variable. The ``ICOTOOL_VERSION_STRING`` result variable is deprecated.
* The :module:`FindJasper` module now provides a ``Jasper_VERSION`` result
variable. The ``JASPER_VERSION_STRING`` result variable is deprecated.

View File

@@ -18,9 +18,13 @@ Result Variables
This module defines the following variables:
``Icotool_FOUND``
True if ``icotool`` has been found. For backward compatibility, the
``ICOTOOL_FOUND`` variable is also set to the same value.
``ICOTOOL_VERSION_STRING``
Boolean indicating whether (the requested version of) ``icotool`` has been
found. For backward compatibility, the ``ICOTOOL_FOUND`` variable is also
set to the same value.
``Icotool_VERSION``
.. versionadded:: 4.2
The version of ``icotool`` found.
Cache Variables
@@ -31,6 +35,17 @@ The following cache variables may also be set:
``ICOTOOL_EXECUTABLE``
The full path to the ``icotool`` tool.
Deprecated Variables
^^^^^^^^^^^^^^^^^^^^
The following variables are provided for backward compatibility:
``ICOTOOL_VERSION_STRING``
.. deprecated:: 4.2
Use ``Icotool_VERSION``, which has the same value.
The version of ``icotool`` found.
Examples
^^^^^^^^
@@ -55,27 +70,23 @@ find_program(ICOTOOL_EXECUTABLE
if(ICOTOOL_EXECUTABLE)
execute_process(
COMMAND ${ICOTOOL_EXECUTABLE} --version
OUTPUT_VARIABLE _icotool_version
OUTPUT_VARIABLE Icotool_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
set( ICOTOOL_VERSION_STRING
"${CMAKE_MATCH_1}"
)
if("${Icotool_VERSION}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
set(Icotool_VERSION "${CMAKE_MATCH_1}")
else()
set( ICOTOOL_VERSION_STRING
""
)
set(Icotool_VERSION "")
endif()
unset(_icotool_version)
set(ICOTOOL_VERSION_STRING "${Icotool_VERSION}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Icotool
REQUIRED_VARS ICOTOOL_EXECUTABLE
VERSION_VAR ICOTOOL_VERSION_STRING
VERSION_VAR Icotool_VERSION
)
mark_as_advanced(

View File

@@ -121,6 +121,7 @@ foreach(
FLEX Freetype
Gettext GIF GnuTLS GNUTLS GTK2
HDF5 Hg HSPELL
Icotool
Jasper JPEG
LibArchive LibLZMA LIBLZMA LibXml2 LibXslt LTTngUST
OpenSceneGraph OPENSCENEGRAPH OpenSSL OPENSSL