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

Brad King brad.king at kitware.com
Thu Oct 26 16:33:44 EDT 2006


Tristan Carel wrote:
> RC1 in attachment.

That looks pretty nice.  Here are a few comments:

1.) Please change EXEC_PROGRAM to EXECUTE_PROCESS.  You can use the new
OUTPUT_STRIP_TRAILING_WHITESPACE option in CVS CMake's EXECUTE_PROCESS
to avoid extra newlines.  Since the module will not be distributed in a
cmake without that feature it should work.

2.) There is a MESSAGE(ERROR) call.  This is invalid.  It should be
MESSAGE(SEND_ERROR).

3.) The proper way to detect if there was a problem with executing a
process is to use the RESULT_VARIABLE option for EXECUTE_PROCESS.  If it
is set to anything other than "0" then there was an error and the
variable contains a message describing it or the return value.  You can
then still use the ERROR_VARIABLE to display other output.

4.) When using the STRING(REGEX) command the input argument should
always be quoted:

STRING(REGEX REPLACE ...
       Subversion_VERSION_SVN ${Subversion_VERSION_SVN})

should be

STRING(REGEX REPLACE ...
       Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")

Otherwise if the variable is empty STRING will complain about having too
few arguments.

5.) There should be no TABs in the source file.

6.) Why is Subversion_SVN_EXECUTABLE marked as advanced only when the
macro is called?  Is that a cut-and-paste error?

Thanks,
-Brad


More information about the CMake mailing list