cpack: set CPACK_RPM_PACKAGE_RELEASE variable so that RPM are incremented

parent 3c2a2a6e
......@@ -198,7 +198,9 @@ check_library_exists("rt" "clock_gettime" "" HAVE_LIBRT)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(tester)
if(ENABLE_TESTS AND CUNIT_FOUND)
add_subdirectory(tester)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
......
......@@ -49,6 +49,17 @@ set(CPACK_SOURCE_IGNORE_FILES
set(CPACK_RPM_COMPONENT_INSTALL OFF)
if("${CPACK_GENERATOR}" STREQUAL "RPM")
find_package(Git)
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count ${PROJECT_VERSION}..HEAD
OUTPUT_VARIABLE CPACK_RPM_PACKAGE_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)
else()
set(CPACK_RPM_PACKAGE_RELEASE "1")
endif()
set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
endif()
......
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