Skip to content

Commit 62f44f8

Browse files
committed
cmake: add static version back
1 parent 89fb69b commit 62f44f8

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

.github/workflows/release.yml

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ jobs:
1212
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v4
15+
- name: Check version bump
16+
run: |
17+
TAG=$(git describe --tags --match "[0-9]*.[0-9]*.[0-9]*" --abbrev=8)
18+
VERSION=$(grep project CMakeLists.txt| awk '{print $3}')
19+
if [ "$TAG" != "$VERSION" ]; then
20+
echo "=== Version in CMakeLists.txt and git tag does not match!"
21+
echo "=== Git Tag: $TAG, Version: $VERSION"
22+
exit 1
23+
fi
1524
- uses: actions/download-artifact@v4
1625
- run: |
1726
mkdir build

CMakeLists.txt

+10-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ cmake_minimum_required(VERSION 3.12.0)
22

33
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
44

5-
include(GetGitVersion)
5+
project(ttyd VERSION 1.7.6 LANGUAGES C)
6+
7+
set(TTYD_VERSION "${PROJECT_VERSION}")
68

9+
include(GetGitVersion)
710
get_git_version(GIT_VERSION SEM_VER)
811
get_git_head(GIT_COMMIT)
9-
10-
project(ttyd VERSION "${SEM_VER}" LANGUAGES C)
11-
12-
if(NOT "{GIT_COMMIT}" STREQUAL "")
13-
set(PROJECT_VERSION "${PROJECT_VERSION}-${GIT_COMMIT}")
12+
if("${SEM_VER}" VERSION_GREATER "${TTYD_VERSION}")
13+
set(TTYD_VERSION "${SEM_VER}")
14+
endif()
15+
if(NOT "${GIT_COMMIT}" STREQUAL "")
16+
set(TTYD_VERSION "${TTYD_VERSION}-${GIT_COMMIT}")
1417
endif()
1518

1619
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
@@ -81,7 +84,7 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES})
8184
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})
8285
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
8386
target_compile_definitions(${PROJECT_NAME} PUBLIC
84-
TTYD_VERSION="${PROJECT_VERSION}"
87+
TTYD_VERSION="${TTYD_VERSION}"
8588
$<$<PLATFORM_ID:Windows>:_WIN32_WINNT=0xa00 WINVER=0xa00>
8689
)
8790

0 commit comments

Comments
 (0)