FindHg¶
Finds the Mercurial command-line client executable (hg
) and provides a
command for extracting information from a Mercurial working copy:
find_package(Hg [<version>] [...])
Result Variables¶
This module defines the following variables:
Hg_FOUND
Boolean 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_STRING
The version of Mercurial found.
Cache Variables¶
The following cache variables may also be set:
HG_EXECUTABLE
Absolute path to the Mercurial command-line client (
hg
).
Commands¶
This module provides the following command when Mercurial client (hg
) is
found:
- Hg_WC_INFO¶
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 aSEND_ERROR
message is generated:<var-prefix>_WC_CHANGESET
Current changeset.
<var-prefix>_WC_REVISION
Current revision.
Examples¶
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()