FindSubversion¶
This module finds a Subversion command-line client executable (svn
) and
provides macros for extracting information from a Subversion working copy.
Result Variables¶
This module defines the following variables:
Subversion_FOUND
True if the Subversion command-line client was found. For backward compatibility, the
SUBVERSION_FOUND
variable is also set to the same value.Subversion_VERSION_SVN
Version of the
svn
command-line client.
Cache Variables¶
The following cache variables may also be set:
Subversion_SVN_EXECUTABLE
Path to the
svn
command-line client.
Macros¶
If the Subversion command-line client is found, the following macros are defined:
- Subversion_WC_INFO¶
Extracts information from a Subversion working copy located at a specified directory:
Subversion_WC_INFO(<dir> <var-prefix> [IGNORE_SVN_FAILURE])
This macro defines the following variables if running Subversion's
info
subcommand on<dir>
succeeds; otherwise aSEND_ERROR
message is generated:<var-prefix>_WC_URL
URL of the repository (at
<dir>
).<var-prefix>_WC_ROOT
Root URL of the repository.
<var-prefix>_WC_REVISION
Current revision.
<var-prefix>_WC_LAST_CHANGED_AUTHOR
Author of last commit.
<var-prefix>_WC_LAST_CHANGED_DATE
Date of last commit.
<var-prefix>_WC_LAST_CHANGED_REV
Revision of last commit.
<var-prefix>_WC_INFO
Output of the command
svn info <dir>
The options are:
IGNORE_SVN_FAILURE
Added 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.
- Subversion_WC_LOG¶
Retrieves the log message of the base revision of a Subversion working copy at a given location:
Subversion_WC_LOG(<dir> <var-prefix>)
This macro defines the following variable if running Subversion's
log
subcommand on<dir>
succeeds; otherwise aSEND_ERROR
message is generated:<var-prefix>_LAST_CHANGED_LOG
Last log of the base revision of a Subversion working copy located at
<dir>
.
Examples¶
Example usage:
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()
The minimum required version of Subversion can be specified using the standard syntax:
find_package(Subversion 1.4)