[CMake] FindSubversion on windows problem and solution.

John Drescher drescherjm at gmail.com
Fri Feb 19 18:44:20 EST 2010


Recently I have moved to appending the svn rev to the end of my patch
version. An example of this is the following:

set (StudyManager_VERSION_MAJOR 0)
set (StudyManager_VERSION_MINOR 0)
set (StudyManager_VERSION_PATCH 0)

#-----------------------------------------------------------------------------
# If subversion is found append the svn rev to the patch version.
#
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}")
	
	set (StudyManager_VERSION_PATCH
${StudyManager_VERSION_PATCH}.${Project_WC_REVISION})
	
ENDIF(Subversion_FOUND)


Under windows I am using the cygwin svn executable for this. The find
module does not automatically find subversion however if I enter it in
cmake-gui in xp64 all is well and I get the expected patch version
appended. However trying this with windows 7 results in cmake never
completing the configure step. I could not figure that out till I
started executing the svn commands cmake would inside my build tree.

c:\cygwin\bin\svn info

That worked fine and made me think this bug was some incompatibility
with windows 7. Eventually I looked at my code again and saw that I
was also using the svn log command so trying that in the command
window showed the reason for the problem. I got prompted for the
password to access the svn server. Since I use TortoiseSVN from
explorer I had never set the password for the console svn executable.


-- 
John M. Drescher


More information about the CMake mailing list