Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refine versioning #279

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/cmake/revisionCMake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,34 @@
#
#

set(build_version_ "unknown")
set(main_revision_ "1.1.0")

set(rel_version_ "unknown")

find_package(Git)
if(GIT_FOUND)
set(tag_ver "v${main_revision_}")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --long
COMMAND ${GIT_EXECUTABLE} describe --all --match ${tag_ver}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE build_version_
OUTPUT_VARIABLE rel_version_
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if("${build_version_}" STREQUAL "")
if("${rel_version_}" STREQUAL "")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE build_version_
OUTPUT_VARIABLE rel_version_
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
else()
message(STATUS "Git not found!")
endif()

set(build_version_ "${main_revision_} ${rel_version_}")
message(STATUS "Build version: ${build_version_}")

set(build_type_ ${CMAKE_BUILD_TYPE})
Expand Down