File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 2
2
# Licensed under the MIT License.
3
3
4
4
cmake_minimum_required (VERSION 3.8.2 )
5
- project (cppgraphqlgen VERSION 3.2.0 )
5
+
6
+ file (TO_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /version.txt" VERSION_FILE )
7
+
8
+ # Get the latest release tag from git if possible.
9
+ execute_process (COMMAND git describe --tags --long
10
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
11
+ OUTPUT_VARIABLE LATEST_VERSION_TAG
12
+ ERROR_QUIET
13
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
14
+
15
+ if ("${LATEST_VERSION_TAG} " MATCHES "^v([0-9]+\\ .[0-9]+\\ .[0-9]+)-[0-9]+-[0-9a-z]+$" )
16
+ # The latest tag matched the pattern we expected, extract the version number.
17
+ set (LATEST_VERSION "${CMAKE_MATCH_1} " )
18
+ message (STATUS "Latest tagged release: v${LATEST_VERSION} " )
19
+
20
+ # Update version.txt so source archives without the release tags can still get the same version.
21
+ file (WRITE "${VERSION_FILE} " "${LATEST_VERSION} " )
22
+ else ()
23
+ # Just read the last updated version from version.txt.
24
+ file (READ "${VERSION_FILE} " LATEST_VERSION )
25
+ endif ()
26
+
27
+ message (STATUS "Latest version: ${LATEST_VERSION} " )
28
+
29
+ project (cppgraphqlgen VERSION ${LATEST_VERSION} )
6
30
7
31
set (CMAKE_CXX_STANDARD 17 )
8
32
Original file line number Diff line number Diff line change
1
+ 3.2.3
You can’t perform that action at this time.
0 commit comments