FindHg: Add Hg_VERSION

This deprecates the HG_VERSION_STRING result variable.

Issue: #27088
This commit is contained in:
Peter Kokot
2025-08-15 05:34:09 +02:00
parent d4113f8288
commit e463cf3283
5 changed files with 21 additions and 6 deletions

View File

@@ -34,6 +34,9 @@ Find Modules
* The :module:`FindGnuTLS` module now provides a ``GnuTLS_VERSION`` result * The :module:`FindGnuTLS` module now provides a ``GnuTLS_VERSION`` result
variable. The ``GNUTLS_VERSION`` result variable is deprecated. variable. The ``GNUTLS_VERSION`` result variable is deprecated.
* The :module:`FindHg` module now provides a ``Hg_VERSION`` result
variable. The ``HG_VERSION_STRING`` result variable is deprecated.
* The :module:`FindJasper` module now provides a ``Jasper_VERSION`` result * The :module:`FindJasper` module now provides a ``Jasper_VERSION`` result
variable. The ``JASPER_VERSION_STRING`` result variable is deprecated. variable. The ``JASPER_VERSION_STRING`` result variable is deprecated.

View File

@@ -1596,7 +1596,7 @@ function(_ep_add_update_command name)
set(hg_tag "tip") set(hg_tag "tip")
endif() endif()
if("${HG_VERSION_STRING}" STREQUAL "2.1") if("${Hg_VERSION}" STREQUAL "2.1")
set(notesAnchor set(notesAnchor
"#A2.1.1:_revert_pull_return_code_change.2C_compile_issue_on_OS_X" "#A2.1.1:_revert_pull_return_code_change.2C_compile_issue_on_OS_X"
) )

View File

@@ -22,7 +22,9 @@ This module defines the following variables:
found. For backward compatibility, the ``HG_FOUND`` variable is also set found. For backward compatibility, the ``HG_FOUND`` variable is also set
to the same value. to the same value.
``HG_VERSION_STRING`` ``Hg_VERSION``
.. versionadded:: 4.2
The version of Mercurial found. The version of Mercurial found.
Cache Variables Cache Variables
@@ -58,6 +60,15 @@ found:
``<var-prefix>_WC_REVISION`` ``<var-prefix>_WC_REVISION``
Current revision. Current revision.
Deprecated Variables
^^^^^^^^^^^^^^^^^^^^
The following variables are provided for backward compatibility:
``HG_VERSION_STRING``
.. deprecated:: 4.2
Use ``Hg_VERSION``, which has the same value.
Examples Examples
^^^^^^^^ ^^^^^^^^
@@ -103,7 +114,8 @@ if(HG_EXECUTABLE)
set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND") set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND")
endif() endif()
if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)") if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)")
set(HG_VERSION_STRING "${CMAKE_MATCH_1}") set(Hg_VERSION "${CMAKE_MATCH_1}")
set(HG_VERSION_STRING "${Hg_VERSION}")
endif() endif()
unset(hg_version) unset(hg_version)
@@ -126,4 +138,4 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Hg find_package_handle_standard_args(Hg
REQUIRED_VARS HG_EXECUTABLE REQUIRED_VARS HG_EXECUTABLE
VERSION_VAR HG_VERSION_STRING) VERSION_VAR Hg_VERSION)

View File

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

View File

@@ -595,7 +595,7 @@ if(EP_TEST_HG)
# #
# Mercurial 2.1 does not distinguish an empty pull from a failed pull, # Mercurial 2.1 does not distinguish an empty pull from a failed pull,
# so do not run the test with that version. # so do not run the test with that version.
if(NOT "${HG_VERSION_STRING}" STREQUAL "2.1") if(NOT Hg_VERSION STREQUAL "2.1")
set(proj TutorialStep1-HG-tip) set(proj TutorialStep1-HG-tip)
ExternalProject_Add(${proj} ExternalProject_Add(${proj}
HG_REPOSITORY "${local_hg_repo}" HG_REPOSITORY "${local_hg_repo}"