Finds the Mercurial command-line client executable (hg) and provides a
command for extracting information from a Mercurial working copy:
find_package(Hg [<version>] [...])
This module defines the following variables:
Hg_FOUNDAdded in version 3.3.
Boolean indicating whether the (requested version of) Mercurial client was found.
Hg_VERSIONAdded in version 4.2.
The version of Mercurial found.
The following cache variables may also be set:
HG_EXECUTABLEAbsolute path to the Mercurial command-line client (hg).
This module provides the following command when Mercurial client (hg) is
found:
Added in version 3.1.
Extracts information of a Mercurial working copy:
Hg_WC_INFO(<dir> <var-prefix>)
This command defines the following variables if running Mercurial client on
working copy located at a given location <dir> succeeds; otherwise a
SEND_ERROR message is generated:
<var-prefix>_WC_CHANGESETCurrent changeset.
<var-prefix>_WC_REVISIONCurrent revision.
The following variables are provided for backward compatibility:
HG_FOUNDDeprecated since version 4.2: Use Hg_FOUND, which has the same value.
Boolean indicating whether the (requested version of) Mercurial client was found.
HG_VERSION_STRINGDeprecated since version 4.2: Use Hg_VERSION, which has the same value.
The version of Mercurial found.
Finding the Mercurial client and retrieving information about the current project's working copy:
find_package(Hg)
if(Hg_FOUND)
Hg_WC_INFO(${PROJECT_SOURCE_DIR} Project)
message("Current revision is ${Project_WC_REVISION}")
message("Current changeset is ${Project_WC_CHANGESET}")
endif()