summaryrefslogtreecommitdiff
path: root/Modules/FindSubversion.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-08-10 14:51:45 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2010-08-10 14:51:45 -0400
commit74805b28c1f55a16310efe43465eb76c4e75f46a (patch)
tree327505f9f2820ca55d099625f387c52d29ac0f71 /Modules/FindSubversion.cmake
parent9cf9d2794c496213f84a78282d56c63763f732d6 (diff)
parent430336c5e1ae90903e3db228594b1c365c26f4a3 (diff)
downloadcmake-74805b28c1f55a16310efe43465eb76c4e75f46a.tar.gz
Merge topic 'ImprovedVersionCheckingInSomeModules'
430336c Merge branch 'findsubversion_fphsa_cleanup' b6c6156 Use FPHSA() in FindSWIG, including version checking. 656cd2f Improved version checking for FindCUDA using the new mode of FPHSA 126db7b Improved version checking for FindSubversion using the new mode of FPHSA() 77d909b Fix DETAILS string with version number in FHPSA() 19b68b9 Improved version checking for FindJava using the new FPHSA() mode 6bb0b6e Improved version checking for FindRuby using the new mode of FPHSA() 946493f FindSquish doesn't detect the version, remove that from the documentation cb9d1ea Add version checking support to FindFlex and FindPerlLibs
Diffstat (limited to 'Modules/FindSubversion.cmake')
-rw-r--r--Modules/FindSubversion.cmake28
1 files changed, 17 insertions, 11 deletions
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index 1bf7a4c2b6..17fbeab020 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -2,7 +2,12 @@
# The module defines the following variables:
# Subversion_SVN_EXECUTABLE - path to svn command line client
# Subversion_VERSION_SVN - version of svn command line client
-# Subversion_FOUND - true if the command line client was found
+# SUBVERSION_FOUND - true if the command line client was found
+# Subversion_FOUND - same as SUBVERSION_FOUND, kept around for compatibility
+#
+# The minimum required version of Subversion can be specified using the
+# standard syntax, e.g. FIND_PACKAGE(Subversion 1.4)
+#
# If the command line client executable is found the macro
# Subversion_WC_INFO(<dir> <var-prefix>)
# is defined to extract information of a subversion working copy at
@@ -17,12 +22,12 @@
# <var-prefix>_WC_INFO - output of command `svn info <dir>'
# Example usage:
# FIND_PACKAGE(Subversion)
-# IF(Subversion_FOUND)
+# 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(Subversion_FOUND)
+# ENDIF(SUBVERSION_FOUND)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -44,17 +49,19 @@ MARK_AS_ADVANCED(Subversion_SVN_EXECUTABLE)
IF(Subversion_SVN_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version
+ OUTPUT_VARIABLE Subversion_VERSION_SVN
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
+ "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
+
MACRO(Subversion_WC_INFO dir prefix)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
SET(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
SET(ENV{LC_ALL} C)
- EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} --version
- WORKING_DIRECTORY ${dir}
- OUTPUT_VARIABLE Subversion_VERSION_SVN
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
@@ -65,8 +72,6 @@ IF(Subversion_SVN_EXECUTABLE)
MESSAGE(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
ELSE(NOT ${Subversion_svn_info_result} EQUAL 0)
- STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
- "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
STRING(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
STRING(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
@@ -105,7 +110,8 @@ IF(Subversion_SVN_EXECUTABLE)
ENDIF(Subversion_SVN_EXECUTABLE)
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion DEFAULT_MSG Subversion_SVN_EXECUTABLE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE
+ VERSION_VAR Subversion_VERSION_SVN )
# for compatibility
SET(Subversion_FOUND ${SUBVERSION_FOUND})