Merge pull request 'cmake: Set package version' (#6) from describe-version into main

Reviewed-on: #6
This commit is contained in:
Xavier Del Campo Romero 2025-01-16 06:31:35 +01:00
commit f0e8573f0e
2 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,24 @@ include(GNUInstallDirs)
set(datadir ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2 CACHE PATH set(datadir ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2 CACHE PATH
"Place where all the static data files should go") "Place where all the static data files should go")
execute_process(
COMMAND git describe --tags --dirty
RESULT_VARIABLE result
OUTPUT_VARIABLE version
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(result EQUAL 0)
# CMAKE_PROJECT_VERSION_TWEAK is used by NSIS packagers
# its what comes after the '-' sign (if anything)
# ie: in tag '2.2.2-rc1' CMAKE_PROJECT_VERSION_TWEAK should be '-rc1'
string(FIND "${version}" "-" index)
if(NOT ${index} EQUAL -1)
string(SUBSTRING ${version} ${index} -1 CMAKE_PROJECT_VERSION_TWEAK)
endif()
endif()
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_package_config_file( configure_package_config_file(

View file

@ -1,6 +1,8 @@
set(CPACK_PACKAGE_NAME "speed-dreams-data") set(CPACK_PACKAGE_NAME "speed-dreams-data")
set(CPACK_PACKAGE_VENDOR "The Speed Dreams Team") set(CPACK_PACKAGE_VENDOR "The Speed Dreams Team")
set(CPACK_PACKAGE_CONTACT "The Speed Dreams Team <https://forge.a-lec.org/speed-dreams>") set(CPACK_PACKAGE_CONTACT "The Speed Dreams Team <https://forge.a-lec.org/speed-dreams>")
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}${CMAKE_PROJECT_VERSION_TWEAK}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION set(CPACK_DEBIAN_PACKAGE_DESCRIPTION