1 # Use git for some maintenance tasks
5 # Add an 'archive' target to generate a compressed archive from the git source code
6 set(ARCHIVE_PREFIX ${CMAKE_PROJECT_NAME}-${PROJECT_VER})
7 find_program(DATE_EXECUTABLE date DOC "date command line program")
9 message(STATUS "Found date: " ${DATE_EXECUTABLE})
10 message(STATUS "Generator is: " ${CMAKE_GENERATOR})
12 # XXX: using $(shell CMD) works only with Unix Makefile
13 if (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
14 message(STATUS " - \"git archive\" will use the date too!")
15 set(ARCHIVE_PREFIX ${ARCHIVE_PREFIX}-$\(shell ${DATE_EXECUTABLE} +%Y%m%d%H%M\))
18 add_custom_target(archive
19 COMMAND ${GIT_EXECUTABLE} archive -o \"${CMAKE_BINARY_DIR}/${ARCHIVE_PREFIX}.tar.gz\" --prefix=\"${ARCHIVE_PREFIX}/\" HEAD
20 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
22 # Add a 'changelog' target to generate a qausi-GNU-style changelog, it may
23 # be used by distributors to ship when building their packages.
24 add_custom_target(changelog
25 COMMAND ${GIT_EXECUTABLE} log --pretty=\"format:%ai %aN <%aE>%n%n%x09* %s%d%n\" > \"${CMAKE_BINARY_DIR}/ChangeLog\"
26 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})