Skip to content

Commit 53eaa69

Browse files
authored
Merge pull request #209 from tim-griesbach/fix-tarball
Fix tarball versioning
2 parents 2d66857 + 5fcd371 commit 53eaa69

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

cmake/install.cmake

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,35 @@ NAMESPACE ${PROJECT_NAME}::
2929
)
3030

3131
# --- CPack
32-
set(CPACK_GENERATOR "TBZ2")
33-
set(CPACK_SOURCE_GENERATOR "TBZ2")
32+
if(WIN32)
33+
set(CPACK_GENERATOR "ZIP")
34+
set(CPACK_SOURCE_GENERATOR "ZIP")
35+
else()
36+
set(CPACK_GENERATOR "TGZ")
37+
set(CPACK_SOURCE_GENERATOR "TGZ")
38+
endif()
3439
set(CPACK_PACKAGE_VENDOR "Carsten Burstedde")
3540
set(CPACK_PACKAGE_CONTACT "Carsten Burstedde")
3641
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
3742
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
3843
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package)
3944
string(TOLOWER ${CMAKE_SYSTEM_NAME} _sys)
40-
set(CPACK_PACKAGE_FILE_NAME "libsc-${git_version}-${_sys}")
41-
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libsc-${git_version}")
45+
string(TOLOWER ${PROJECT_NAME} _project_lower)
46+
47+
# Define a variable for the version file
48+
set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/.tarball-version")
49+
50+
# Generate .tarball-version file
51+
add_custom_command(
52+
OUTPUT ${VERSION_FILE}
53+
COMMAND ${CMAKE_COMMAND} -E echo "${PROJECT_VERSION}" > ${VERSION_FILE}
54+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
55+
)
56+
57+
add_custom_target(${PROJECT_NAME}_VersionFile ALL DEPENDS ${VERSION_FILE})
58+
59+
set(CPACK_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}-${_sys}")
60+
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_lower}-${PROJECT_VERSION}")
4261

4362
# not .gitignore as its regex syntax is more advanced than CMake
4463
set(CPACK_SOURCE_IGNORE_FILES .git/ .github/ .vscode/ _CPack_Packages/

doc/release_notes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Make sure to use SC_ENABLE_* CMake variables
2828
- Adapt CMake CI to matrix of latest compilers
2929
- Check for MPI_Aint_diff in CMake and Autoconf
30+
- Fix tarball naming and add a CMake target to generate .tarball-version file
3031

3132
## 2.8.6
3233

0 commit comments

Comments
 (0)