mirror of https://github.com/polybar/polybar.git
Co-authored-by: Valentino Berta <eltinopa@icloud.com>
This commit is contained in:
parent
790f129954
commit
2c9bde9576
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Build
|
### Build
|
||||||
- Fixed compiler error in GCC 15 ([`#3159`](https://github.com/polybar/polybar/pull/3159))
|
- Fixed compiler error in GCC 15 ([`#3159`](https://github.com/polybar/polybar/pull/3159))
|
||||||
|
- Fixed version detection if release tarball is built in another repository. ([`#3152`](https://github.com/polybar/polybar/issues/3152), [`#3156`](https://github.com/polybar/polybar/pull/3156))
|
||||||
|
|
||||||
## [3.7.2] - 2024-08-17
|
## [3.7.2] - 2024-08-17
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -8,20 +8,41 @@ project(polybar CXX)
|
||||||
# a version string is used, so the file supports comments
|
# a version string is used, so the file supports comments
|
||||||
file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1)
|
file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1)
|
||||||
|
|
||||||
# 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 rev-parse --show-toplevel
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
RESULT_VARIABLE git_result
|
RESULT_VARIABLE git_top_dir_result
|
||||||
OUTPUT_VARIABLE git_describe
|
OUTPUT_VARIABLE git_top_dir
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||||
|
|
||||||
if(git_result EQUAL "0")
|
# Set fallback first, override if more information (from git) is found
|
||||||
set(APP_VERSION "${git_describe}")
|
set(APP_VERSION "${version_txt}")
|
||||||
else()
|
|
||||||
message(STATUS "Could not detect version with git, falling back to built-in version information.")
|
# Prevent formatting errors & resolve symlinks (REALPATH)
|
||||||
set(APP_VERSION "${version_txt}")
|
get_filename_component(resolved_project_source_dir ${PROJECT_SOURCE_DIR} REALPATH)
|
||||||
|
if(NOT ("${git_top_dir}" STREQUAL ""))
|
||||||
|
get_filename_component(git_top_dir ${git_top_dir} REALPATH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(git_top_dir_result EQUAL "0" AND git_top_dir STREQUAL resolved_project_source_dir)
|
||||||
|
# If we are in a git repo we can get the version information from git describe
|
||||||
|
execute_process(COMMAND git describe --tags --dirty=-dev
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE git_describe_result
|
||||||
|
OUTPUT_VARIABLE git_describe
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||||
|
|
||||||
|
if(git_describe_result EQUAL "0")
|
||||||
|
set(APP_VERSION "${git_describe}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Could not detect version with git, falling back to built-in version information.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(STATUS "CMake and git directory mismatch, falling back to built-in version information.") # Assuming that if git rev-parse doesn't return 0, git describe won't either
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Set the default installation prefix to /usr
|
# Set the default installation prefix to /usr
|
||||||
# Otherwise the default value is /usr/local which causes the default config
|
# Otherwise the default value is /usr/local which causes the default config
|
||||||
# file to be installed to /usr/local/etc, with /usr, cmake has special handling
|
# file to be installed to /usr/local/etc, with /usr, cmake has special handling
|
||||||
|
|
Loading…
Reference in New Issue