2022-02-20 05:27:41 +00:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2023-10-09 19:29:22 +00:00
|
|
|
index 2b49e11288..0a4a69b9a0 100644
|
2022-02-20 05:27:41 +00:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2023-10-09 19:29:22 +00:00
|
|
|
@@ -244,52 +244,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
|
2022-02-20 05:27:41 +00:00
|
|
|
set(SUN TRUE)
|
|
|
|
endif()
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
-find_package(Git)
|
|
|
|
-if(Git_FOUND)
|
|
|
|
- if (NOT DEFINED GIT_COMMIT_HASH)
|
|
|
|
- execute_process(
|
|
|
|
- COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
|
|
|
|
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
- RESULT_VARIABLE GIT_RESULT
|
|
|
|
- OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
- endif()
|
|
|
|
- execute_process(
|
|
|
|
- COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
|
|
|
|
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
- OUTPUT_VARIABLE GIT_LAST_TAG
|
|
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
- execute_process(
|
|
|
|
- COMMAND ${GIT_EXECUTABLE} describe --tags --long
|
|
|
|
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
- OUTPUT_VARIABLE GIT_ITERATION
|
|
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
-else()
|
|
|
|
- message("Git NOT FOUND")
|
|
|
|
-endif()
|
2022-02-20 05:27:41 +00:00
|
|
|
-
|
|
|
|
-if(GIT_RESULT EQUAL "0")
|
|
|
|
- string(REGEX REPLACE "v([0-9]+).[0-9]+.[0-9]+" "\\1" DUCKDB_MAJOR_VERSION "${GIT_LAST_TAG}")
|
|
|
|
- string(REGEX REPLACE "v[0-9]+.([0-9]+).[0-9]+" "\\1" DUCKDB_MINOR_VERSION "${GIT_LAST_TAG}")
|
|
|
|
- string(REGEX REPLACE "v[0-9]+.[0-9]+.([0-9]+)" "\\1" DUCKDB_PATCH_VERSION "${GIT_LAST_TAG}")
|
|
|
|
- string(REGEX REPLACE ".*-([0-9]+)-.*" "\\1" DUCKDB_DEV_ITERATION "${GIT_ITERATION}")
|
|
|
|
-
|
|
|
|
- if(DUCKDB_DEV_ITERATION EQUAL 0)
|
|
|
|
- # on a tag; directly use the version
|
|
|
|
- set(DUCKDB_VERSION "${GIT_LAST_TAG}")
|
|
|
|
- else()
|
|
|
|
- # not on a tag, increment the patch version by one and add a -devX suffix
|
|
|
|
- math(EXPR DUCKDB_PATCH_VERSION "${DUCKDB_PATCH_VERSION}+1")
|
|
|
|
- set(DUCKDB_VERSION "v${DUCKDB_MAJOR_VERSION}.${DUCKDB_MINOR_VERSION}.${DUCKDB_PATCH_VERSION}-dev${DUCKDB_DEV_ITERATION}")
|
|
|
|
- endif()
|
|
|
|
-else()
|
|
|
|
- # fallback for when building from tarball
|
|
|
|
- set(DUCKDB_MAJOR_VERSION 0)
|
|
|
|
- set(DUCKDB_MINOR_VERSION 0)
|
|
|
|
- set(DUCKDB_PATCH_VERSION 1)
|
|
|
|
- set(DUCKDB_DEV_ITERATION 0)
|
|
|
|
- set(DUCKDB_VERSION "v${DUCKDB_MAJOR_VERSION}.${DUCKDB_MINOR_VERSION}.${DUCKDB_PATCH_VERSION}-dev${DUCKDB_DEV_ITERATION}")
|
|
|
|
-endif()
|
2024-02-29 20:09:43 +00:00
|
|
|
+set(DUCKDB_VERSION "@version@")
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
message(STATUS "git hash ${GIT_COMMIT_HASH}, version ${DUCKDB_VERSION}")
|
|
|
|
|