Title: RE: [CMake] XML parsing ?

> I am wondering if it is currently possible using CMake to
> parse an XML file...
> I would like to include the SVN revision number in the target
> name somehow, and I would need to get it from the .svn/entries
> file I guess...

Actually, you should not be parsing .svn/entries. Subversion comes
with a program named svnversion that will return the revision number of
a file or directory. You can use it from CMake like this:

######
project( BOOJUM )

find_program( SVNVERSION
  svnversion
  /usr/local/bin
  /usr/bin
)

macro( svn_repository_version DESTVAR TOPDIR )
  exec_program( ${SVNVERSION} ${TOPDIR} ARGS "." OUTPUT_VARIABLE ${DESTVAR} )
endmacro( svn_repository_version )

svn_repository_version( SVNREV ${BOOJUM_SOURCE_DIR} )

configure_file( version.h.in version.h )


######
and if version.h.in contains the line:

    #define BOOJUM_REVISION @SVNREV@

then CMake will replace @SVNREV@ with the proper number when the file
is configured.

    David

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to