[CMake] [SUBVERSION] Retrieve details of your working copy

Brad King brad.king at kitware.com
Thu Oct 26 14:05:53 EDT 2006


Tristan Carel wrote:
> 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'

The readme is meant to specify a naming convention for each purpose.
You can use SUBVERSION_SVN_EXECUTABLE.

>> FIND_PACKAGE(Subversion)
>> IF(SUBVERSION_FOUND)
>>   SUBVERSION_REPOSITORY(${PROJECT_SOURCE_DIR})
>> ENDIF(SUBVERSION_FOUND)
> 
> FindSubversion.cmake   -> capitalized
> vs
> IF(SUBVERSION_FOUND)   -> uppercased

You're right.  This should have been IF(Subversion_FOUND) in my example.

> 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?

For a while I was arguming that the case-ness should always match but I
think its too late.  Just use what you think is nice and document it.
You could name all your variables Subversion_SVN_EXECUTABLE, etc.

> 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" ?

No, it just means the FIND_PACKAGE command will never cause an error.

> 2 Is a fatal error recommanded above? I guess a FATAL_ERROR message in
> a module is rude but in this case necessary.

It should be used if the REQUIRED option is given to the command.  Look
at the bottom of FindBoost.cmake for the correct user feedback messages
based on QUIET and REQUIRED.

-Brad


More information about the CMake mailing list