On Fri, Feb 27, 2009 at 7:36 AM, Eric Noulard <eric.noul...@gmail.com> wrote: > 2009/2/27 Aaron Turner <synfina...@gmail.com>: >> When I was using autotools, I'd hook up a target "version" to >> "dist-gzip" so that my version.c (which was auto-generated and had my >> svn repo revision in it) was always up to date when I built my source >> tarball. Is there a way to do that with cpack's package_source >> target? >> >> Doing the obvious: >> >> add_dependencies(package_source version) >> >> Doesn't work since I'm guessing package_source is another one of those >> "fake" targets. > > Yes I think this is worth a feature request regarding > how to "add_dependencies" on builtin target > (install, package_source, package, etc....) > >> Unfortunately, since package_source doesn't depend on >> the ALL target, I can't hook it up that way nor does there seem to be >> anything like a CPACK_SOURCE_INCLUDE_FILES (which would be the >> opposite of CPACK_SOURCE_IGNORE_FILES). > > A possible way to do what you want is to create > your own > > package_source_cleanly target > > with something like: > > ADD_CUSTOM_TARGET(package_source_cleanly > COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/PackageSourceCleanly.cmake > ) > > The PackageSourceCleanly.cmake file is your custom CMake script, which > may force an extra CMake execution before calling cpack itself, for example: > > MESSAGE(STATUS "Enforce CMake re-run...") > EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} . > TIMEOUT 3600 > WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) > MESSAGE(STATUS "Enforce CMake re-run...Done.") > > MESSAGE(STATUS "Package Source running cpack...") > EXECUTE_PROCESS(COMMAND cpack -G TGZ --config CPackSourceConfig.cmake > TIMEOUT 3600 > WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) > > MESSAGE(STATUS "Copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz --> > ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${WHO_OUT}-${DATE_OUT}.tar.gz") > EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy > ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz > ${CPACK_SOURCE_PACKAGE_FILE_NAME}-clean.tar.gz) > MESSAGE(STATUS "Package backup done in: > ${CPACK_SOURCE_PACKAGE_FILE_NAME}-clean.tar.gz") > > I do use this kind of "trick" for building dated package backup. > see > http://www.cmake.org/pipermail/cmake/2008-November/025246.html > You'll find a modified version of the scripts sent by Ioan at that time.
So is there a clean way to pass the current Cmake config variables to a new cmake process via execute_process()? Or do I need to create a template file and use configure_file() to do that? Basically, your above example doesn't work for me because things like ${CPACK_SOURCE_PACKAGE_FILE_NAME} are undefined. -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin _______________________________________________ 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