[CMake] [SUBVERSION] Retrieve details of your working copy
Tristan Carel
tristan.carel at gmail.com
Thu Oct 26 13:32:51 EDT 2006
On 10/26/06, Brad King <brad.king at kitware.com> wrote:
> Tristan Carel wrote:
> > To use it:
> > ### Extract information from the current subversion working copy
> > INCLUDE(UseSubversion.cmake)
> > IF(SUBVERSION_SVN_FOUND)
> > SUBVERSION_REPOSITORY(${PROJECT_SOURCE_DIR})
> > ENDIF(SUBVERSION_SVN_FOUND)
>
> This looks like a nice module. You should be able to convert it to a
> find module to improve the interface since it just finds an executable
> and provides a macro. Try renaming the module to FindSubversion.cmake
> and following the conventions specified in the Modules/readme.txt file
> in the CMake source tree
In Modules/readme.txt, in the list of variables to provide, I can read:
-------------------
XXX_EXECUTABLE Where to find the XXX tool.
XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX.
-------------------
Subversion is a set of tool. For the moment the module only uses the
command `svn' but we can imagine that one day the module could provide
commands to be used in server side (thank to `svnlook' for example)
So as the module refers to a set:
- Do I need to define SUBVERSION_EXECUTABLE?
- SUBVERSION_EXECUTABLE refers to the main program of the set? in this
case `svn'
> FIND_PACKAGE(Subversion)
> IF(SUBVERSION_FOUND)
> SUBVERSION_REPOSITORY(${PROJECT_SOURCE_DIR})
> ENDIF(SUBVERSION_FOUND)
FindSubversion.cmake -> capitalized
vs
IF(SUBVERSION_FOUND) -> uppercased
but:
1. CMake defines the variable `Subversion_FIND_QUIETLY' if option
`QUIET' is specified in the `FIND_PACKAGE' command.
2. Most modules provided whose name is capitalized use uppercases variables.
Ok Ok, the problem is resolved if the module is named
FindSUBVERSION.cmake but it's less sexy :)
So? What's your philisophy?
I've got 2 questions about the QUIET option in the command FIND_PACKAGE
in `Modules/Readme.txt', we can read:
"If this variable is set the module should not complain about not being
able to find the package and should never issue a FATAL_ERROR."
1. Does it means too "No fatal error even when user calls a macro
defined in this module" ?
2 Is a fatal error recommanded above? I guess a FATAL_ERROR message in
a module is rude but in this case necessary.
--- UseSubversion.cmake 2006-10-26 13:00:40.000000000 -0400
+++ FindSubversion.cmake 2006-10-26 12:59:01.000000000 -0400
@@ -1,4 +1,4 @@
-# - Extract information from a subversion repository
+# - Extract information from a subversion working copy
# The module defines the following variables:
# SUBVERSION_SVN_EXECUTABLE - path to the subversion command line client
# SUBVERSION_VERSION_SVN - version of the subversion command line client
@@ -62,9 +62,11 @@
ERROR_VARIABLE svn_info_error)
IF(NOT ${svn_info_error})
- MESSAGE(ERROR "
+ IF(NOT Subversion_FIND_QUIETLY)
+ MESSAGE(ERROR "
while executing command `svn info ${location}'. Error message:
${svn_info_error}")
+ ENDIF(NOT Subversion_FIND_QUIETLY)
ELSE(NOT ${svn_info_error})
STRING(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" "\\2"
@@ -85,4 +87,4 @@
ENDIF(SUBVERSION_SVN_EXECUTABLE)
-# UseSubversion.cmake ends here.
+# FindSubversion.cmake ends here.
Thx
--
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.
http://tristan-carel.com
More information about the CMake
mailing list