The call is during CMake time. Which means you need to rerun cmake if your repository version runs. I guess you could try an add_custom_command(...) and run the SVN command to get the revision number and make it a prebuild step for one of your targets. Then it should get run at every build. -- Mike Jackson <www.bluequartz.net>
On Mar 8, 2012, at 4:44 PM, Glenn Ramsey wrote: > Hi Mike, > > When, during the build process is the call to the SCM made? If it is at build > time, rather than cmake time, then how do you do it? > > Glenn > > On 09/03/12 10:15, Michael Jackson wrote: >> I do something like this in my CPack file: >> >> set(DREAM3D_VERSION_SHORT "${DREAM3DLib_VER_MAJOR}.${DREAM3DLib_VER_MINOR}") >> >> set(CPACK_PACKAGE_FILE_NAME >> "DREAM3D-${DREAM3D_VERSION_SHORT}-${CMAKE_SYSTEM_NAME}") >> >> >> Where the DREAM3D_Lib_VER_* variables are generated with a call to my SCM >> (git in my case) >> -- >> Mike Jackson<www.bluequartz.net> >> >> On Mar 8, 2012, at 3:57 PM, Glenn Ramsey wrote: >> >>> Is it possible to add, at build time, a revision number to the installer >>> file name produced by CPack? I understand that to get the revision number >>> at build time one must run a command and I have used that technique to >>> generate a source code header, but I cannot figure out how to apply it to >>> the package file name. The simplest method would appear to be to add a >>> post-build command that renames the file to the package target, but it >>> appears that this cannot be currently done [1]. >>> >>> A previous list message [1] suggests the following: >>> >>>> If you want to hook it up automatically, you could write your own >>>> version of the package target that just calls cpack itself in >>>> ${CMAKE_BINARY_DIR}. That target could have a post-build rule that >>>> does the rename. >>> >>> When I tried that. It created an infinite loop with cpack calling make and >>> make calling cpack. >>> >>> What would I need to do to correctly implement this solution? Is there >>> another way to do it? >>> >>> Glenn >>> >>> [1]<http://www.cmake.org/pipermail/cmake/2011-May/044440.html> >>> -- > > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake