CMakeLists.txt: git rev-list --count is only available since git 1.7.10

parent 53cd01a0
......@@ -47,23 +47,23 @@ set(CPACK_SOURCE_IGNORE_FILES
#set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME ${PACKAGE})
#set(CPACK_COMPONENT_DEVEL_DISPLAY_NAME ${PACKAGE}-devel)
find_package(Git)
find_package(Git 1.7.10) # --count option of git rev-list is available only since (more or less) git 1.7.10
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count ${PROJECT_VERSION}..HEAD
OUTPUT_VARIABLE PROJECT_VERSION_BUILD
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/..
)
# if BUILD VERSION is available, append it to package filename
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
else()
set(PROJECT_VERSION_BUILD "1")
set(CPACK_RPM_PACKAGE_RELEASE "${PROJECT_VERSION_BUILD}")
set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_BUILD}")
endif()
set(CPACK_RPM_COMPONENT_INSTALL OFF)
if("${CPACK_GENERATOR}" STREQUAL "RPM")
set(CPACK_RPM_PACKAGE_RELEASE "${PROJECT_VERSION_BUILD}")
set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
endif()
......@@ -75,7 +75,6 @@ if("${CPACK_GENERATOR}" STREQUAL "RPM" OR "${CPACK_GENERATOR}" STREQUAL "DEB")
endif()
if("${CPACK_GENERATOR}" STREQUAL "DEB")
set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_BUILD}")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(SHLIBS_FILE "${CMAKE_CURRENT_BINARY_DIR}/shlibs")
file(WRITE "${SHLIBS_FILE}" "libbctoolbox ${BCTOOLBOX_SO_VERSION} ${CPACK_PACKAGE_NAME}\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment