Finds a Subversion command-line client executable (svn) and provides
commands for extracting information from a Subversion working copy:
find_package(Subversion [<version>] [...])
This module defines the following variables:
Subversion_FOUNDBoolean indicating whether (the requested version of) Subversion command-line
client is found. For backward compatibility, the SUBVERSION_FOUND
variable is also set to the same value.
Subversion_VERSION_SVNVersion of the svn command-line client found.
The following cache variables may also be set:
Subversion_SVN_EXECUTABLEPath to the svn command-line client.
This module provides the following commands if the Subversion command-line client is found:
Extracts information from a Subversion working copy located at a specified directory:
Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
This command defines the following variables if running Subversion's info
subcommand on <dir> succeeds; otherwise a SEND_ERROR message is
generated:
<var-prefix>_WC_URLURL of the repository (at <dir>).
<var-prefix>_WC_ROOTRoot URL of the repository.
<var-prefix>_WC_REVISIONCurrent revision.
<var-prefix>_WC_LAST_CHANGED_AUTHORAuthor of last commit.
<var-prefix>_WC_LAST_CHANGED_DATEDate of last commit.
<var-prefix>_WC_LAST_CHANGED_REVRevision of last commit.
<var-prefix>_WC_INFOOutput of the command svn info <dir>
The options are:
IGNORE_SVN_FAILUREAdded in version 3.13.
When specified, errors from Subversion operation will not trigger a
SEND_ERROR message. In case of an error, the <var-prefix>_*
variables remain undefined.
Retrieves the log message of the base revision of a Subversion working copy at a given location:
Subversion_WC_LOG(<dir> <var-prefix>)
This command defines the following variable if running Subversion's log
subcommand on <dir> succeeds; otherwise a SEND_ERROR message is
generated:
<var-prefix>_LAST_CHANGED_LOGLast log of the base revision of a Subversion working copy located at
<dir>.
Finding Subversion:
find_package(Subversion)
Or, finding Subversion and specifying a minimum required version:
find_package(Subversion 1.4)
Or, finding Subversion and making it required (if not found, processing stops with an error message):
find_package(Subversion REQUIRED)
Finding Subversion and retrieving information about the current project's working copy:
find_package(Subversion)
if(Subversion_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
message("Current revision is ${Project_WC_REVISION}")
Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
message("Last changed log is ${Project_LAST_CHANGED_LOG}")
endif()