hackrf/host/cmake/set_release.cmake
Michael Ossmann b6acd66cfe set version to 2022.09.1
Starting with this release we will no longer use "unknown" as the
default software version string used in cases where the version cannot
be determined from context. Instead we commit the release version string
to git so that any software built from the tagged commit will have the
appropriate release version string. After the release we will commit a
post-release version string as the new default.

We will continue to use the commit hash as version string when the
software is built inside a git repository.
2022-09-29 05:20:39 -04:00

25 lines
636 B
CMake

if(NOT DEFINED RELEASE)
execute_process(
COMMAND git log -n 1 --format=%h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE GIT_EXIT_VALUE
ERROR_QUIET
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (GIT_EXIT_VALUE)
set(RELEASE "2022.09.1")
else (GIT_EXIT_VALUE)
execute_process(
COMMAND git status -s --untracked-files=no
OUTPUT_VARIABLE DIRTY
)
if ( NOT "${DIRTY}" STREQUAL "" )
set(DIRTY_FLAG "*")
else()
set(DIRTY_FLAG "")
endif()
set(RELEASE "git-${GIT_VERSION}${DIRTY_FLAG}")
endif (GIT_EXIT_VALUE)
endif()