cmake: put version string into version.txt
This commit is contained in:
parent
72db0538e1
commit
7d0c6300f6
@ -22,12 +22,9 @@ endif()
|
|||||||
|
|
||||||
project(polybar C CXX)
|
project(polybar C CXX)
|
||||||
|
|
||||||
# Polybar version information
|
# Extract version information from version.txt. The first line that looks like
|
||||||
# Update this on every release
|
# a version string is used, so the file supports comments
|
||||||
# This is used to create the version string if a git repo is not available
|
file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1)
|
||||||
set(VERSION_MAJOR "3")
|
|
||||||
set(VERSION_MINOR "3")
|
|
||||||
set(VERSION_PATCH "0")
|
|
||||||
|
|
||||||
# If we are in a git repo we can get the version information from git describe
|
# If we are in a git repo we can get the version information from git describe
|
||||||
execute_process(COMMAND git describe --tags --dirty=-dev
|
execute_process(COMMAND git describe --tags --dirty=-dev
|
||||||
@ -40,7 +37,7 @@ if(git_result EQUAL "0")
|
|||||||
set(APP_VERSION "${git_describe}")
|
set(APP_VERSION "${git_describe}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Could not detect version with git, falling back to built-in version information.")
|
message(STATUS "Could not detect version with git, falling back to built-in version information.")
|
||||||
set(APP_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
set(APP_VERSION "${version_txt}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
STRING(REGEX REPLACE "[^a-zA-Z0-9_]" "_" APP_VERSION_NAMESPACE "v${APP_VERSION}")
|
STRING(REGEX REPLACE "[^a-zA-Z0-9_]" "_" APP_VERSION_NAMESPACE "v${APP_VERSION}")
|
||||||
|
4
version.txt
Normal file
4
version.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Polybar version information
|
||||||
|
# Update this on every release
|
||||||
|
# This is used to create the version string if a git repo is not available
|
||||||
|
3.3.0
|
Loading…
Reference in New Issue
Block a user