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_FOUNDBoolean indicating whether (the requested version of) Mercurial client is
found. For backward compatibility, the HG_FOUND variable is also set
to the same value.
HG_VERSION_STRINGThe 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.
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()