FindHg

从 mercurial 工作副本中提取信息。

模块定义以下变量

HG_EXECUTABLE - path to mercurial command line client (hg)
HG_FOUND - true if the command line client was found
HG_VERSION_STRING - the version of mercurial found

3.1 版新增:如果找到命令行客户端可执行文件,则定义以下宏

HG_WC_INFO(<dir> <var-prefix>)

Hg_WC_INFO 提取在给定位置的 mercurial 工作副本的信息。此宏定义以下变量

<var-prefix>_WC_CHANGESET - current changeset
<var-prefix>_WC_REVISION - current revision

用法示例

find_package(Hg)
if(HG_FOUND)
  message("hg found: ${HG_EXECUTABLE}")
  HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
  message("Current revision is ${Project_WC_REVISION}")
  message("Current changeset is ${Project_WC_CHANGESET}")
endif()