From a0dd75c3ae4a7ddc66ddbe4758b5f3de9af233a7 Mon Sep 17 00:00:00 2001 From: Tim Griesbach Date: Mon, 18 Nov 2024 16:19:28 +0100 Subject: [PATCH 1/3] Fix tarball versioning --- cmake/install.cmake | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cmake/install.cmake b/cmake/install.cmake index f4f92c499..faadfbd20 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -38,8 +38,21 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package) string(TOLOWER ${CMAKE_SYSTEM_NAME} _sys) string(TOLOWER ${PROJECT_NAME} _project_lower) -set(CPACK_PACKAGE_FILE_NAME "${_project_lower}-${git_version}-${_sys}") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_lower}-${git_version}") + +# Define a variable for the version file +set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/.tarball-version") + +# Generate .tarball-version file +add_custom_command( + OUTPUT ${VERSION_FILE} + COMMAND ${CMAKE_COMMAND} -E echo "${PROJECT_VERSION}" > ${VERSION_FILE} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ) + +add_custom_target(GenerateVersionFile ALL DEPENDS ${VERSION_FILE}) + +set(CPACK_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}-${_sys}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}") # not .gitignore as its regex syntax is more advanced than CMake set(CPACK_SOURCE_IGNORE_FILES .git/ .github/ .vscode/ _CPack_Packages/ From 86cc0beea6336c5a4e5b268e5cd4e19ee47667bc Mon Sep 17 00:00:00 2001 From: Tim Griesbach Date: Tue, 19 Nov 2024 18:14:45 +0100 Subject: [PATCH 2/3] Prefix version file target --- cmake/install.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/install.cmake b/cmake/install.cmake index faadfbd20..2378b22be 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -47,9 +47,9 @@ add_custom_command( OUTPUT ${VERSION_FILE} COMMAND ${CMAKE_COMMAND} -E echo "${PROJECT_VERSION}" > ${VERSION_FILE} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ) + ) -add_custom_target(GenerateVersionFile ALL DEPENDS ${VERSION_FILE}) +add_custom_target(P4EST_GenerateVersionFile ALL DEPENDS ${VERSION_FILE}) set(CPACK_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}-${_sys}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}") From 3f50724fafb33bd56844452102708526f1230042 Mon Sep 17 00:00:00 2001 From: Tim Griesbach Date: Wed, 4 Dec 2024 17:25:19 +0100 Subject: [PATCH 3/3] Use project name as version file prefix --- cmake/install.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/install.cmake b/cmake/install.cmake index 2378b22be..7fa3d4c0f 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -49,7 +49,7 @@ add_custom_command( DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ) -add_custom_target(P4EST_GenerateVersionFile ALL DEPENDS ${VERSION_FILE}) +add_custom_target(${PROJECT_NAME}_VersionFile ALL DEPENDS ${VERSION_FILE}) set(CPACK_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}-${_sys}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}")