summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-tarball.cmake
blob: 1f292af773607a6a092400e8c562a36428c40cef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
string(TIMESTAMP filename-date "%Y%m%d")
set(filename-ostype ${CMAKE_SYSTEM_NAME})
get_git_head_revision(filename-branch_0 filename-hash_0)
if(filename-hash_0)
    string(SUBSTRING "${filename-hash_0}" 0 7 filename-hash)
endif()
string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}")
string(REPLACE "/" "-" filename-branch "${filename-branch_1}")
set(filename_0 "${OPENTRACK_COMMIT}")
set(filename_1)
if (NOT OPENTRACK_TAG_EXACT STREQUAL OPENTRACK_COMMIT)
    string(TIMESTAMP filename_1 "-%Y%m%d%H%M%S")
endif()
if (NOT filename-branch STREQUAL "unstable")
    string(CONCAT filename_0 ${filename_0} "-" ${filename-branch})
endif()
set(filename "${CMAKE_BINARY_DIR}/${filename_0}${filename_1}.zip")

add_custom_target(tarball-real)
add_custom_target(tarball-real2)
add_custom_command(TARGET tarball-real COMMAND cmake -P ${CMAKE_SOURCE_DIR}/cmake/tarball.cmake)

add_custom_command(TARGET tarball-real2 COMMAND sh
    "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}"
    "${filename}" "${CMAKE_BINARY_DIR}")
add_custom_target(tarball DEPENDS tarball-real)