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>] [...])
結果變數¶
該模組定義了以下變數:
Hg_FOUND在 3.3 版被加入.
Boolean indicating whether the (requested version of) Mercurial client was found.
Hg_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:
- Hg_WC_INFO¶
在 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_ERRORmessage is generated:<var-prefix>_WC_CHANGESETCurrent changeset.
<var-prefix>_WC_REVISIONCurrent revision.
已棄用的變數¶
The following variables are provided for backward compatibility:
HG_FOUND在 4.2 版之後被棄用: Use
Hg_FOUND, which has the same value.Boolean indicating whether the (requested version of) Mercurial client was found.
HG_VERSION_STRING在 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()