[CMake] Put svn revision into file on every "make install"
Jean-Pierre Bergamin
james at ractive.ch
Mon Jun 15 08:04:28 EDT 2009
Hello Eric
> 2009/6/15 Jean-Pierre Bergamin <james at ractive.ch>:
> > Hello cmake users
> >
> > I want to put the current subversion revision into a script every time I
> run
> > "make install".
> > Currently, I use configure_file() to replace a variable in the script,
but
> > this only updates the script when either the script or something in
> > CMakeLists.txt changes.
> >
> > Is there a way to update the script every time I run "make install"?
>
> Did you try with
> install([[SCRIPT <file>] [CODE <code>]] [...])
>
> using this you may execute a CMake script at install time.
Good idea. This may lead to what I'm looking for. My svn_revision.cmake
script now looks like this:
find_package(Subversion)
if(Subversion_FOUND)
Subversion_WC_INFO(${ER_SOURCE_DIR} ER)
set(REVISION ${ER_WC_REVISION})
configure_file(${ER_SOURCE_DIR}/scripts/version.sh.in
${ER_SOURCE_DIR}/scripts/version.sh @ONLY)
endif(Subversion_FOUND)
It is invoked in CMakeLists.txt with "install(SCRIPT svn_revision.cmake)".
The only problem I have now is that ${ER_SOURCE_DIR} is not defined in the
external script. Is there a way to pass arguments to this svn_revision.cmake
script?
Regards
James
More information about the CMake
mailing list