diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 540db8d..e5163f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: '0' - name: Install packaged dependencies run: .github/install_dependencies diff --git a/CMakeLists.txt b/CMakeLists.txt index bf72ef5..a4d92be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,9 @@ cmake_minimum_required (VERSION 3.1) project (RTLSDR-Airband CXX) -set (RTL_AIRBAND_VERSION_MAJOR 5) -set (RTL_AIRBAND_VERSION_MINOR 0) -set (RTL_AIRBAND_VERSION_PATCH 0) -set (RTL_AIRBAND_VERSION "${RTL_AIRBAND_VERSION_MAJOR}.${RTL_AIRBAND_VERSION_MINOR}.${RTL_AIRBAND_VERSION_PATCH}") +execute_process(COMMAND git describe --tags --abbrev --dirty --always + OUTPUT_VARIABLE RTL_AIRBAND_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) set (CMAKE_CXX_STANDARD 11) set (CXX_STANDARD_REQUIRED ON) @@ -26,4 +25,3 @@ if(DEBUG_SQUELCH) endif() add_subdirectory (src) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4155a26..4fcf473 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -248,6 +248,7 @@ else() endif() message(STATUS "RTLSDR-Airband configuration summary:\n") +message(STATUS "- Version string:\t\t${RTL_AIRBAND_VERSION}") message(STATUS "- Build type:\t\t${CMAKE_BUILD_TYPE}") message(STATUS "- Operating system:\t\t${CMAKE_SYSTEM_NAME}") message(STATUS "- SDR drivers:") diff --git a/src/CMakeModules/version.cmake b/src/CMakeModules/version.cmake index 6e734ea..607e02b 100644 --- a/src/CMakeModules/version.cmake +++ b/src/CMakeModules/version.cmake @@ -1,19 +1,4 @@ -set (VERSION "char const *RTL_AIRBAND_VERSION=\"") -execute_process(COMMAND git describe --always --tags --dirty - OUTPUT_VARIABLE GIT_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - -if ("${GIT_VERSION}" STREQUAL "") - string(APPEND VERSION "${RTL_AIRBAND_VERSION}") -elseif("${GIT_VERSION}" MATCHES ".+-g(.+)") - string(APPEND VERSION "${RTL_AIRBAND_VERSION}-${CMAKE_MATCH_1}") -elseif("${GIT_VERSION}" MATCHES "v(.+)") - string(APPEND VERSION "${CMAKE_MATCH_1}") -else() - string(APPEND VERSION "${RTL_AIRBAND_VERSION}-${GIT_VERSION}") -endif() -string(APPEND VERSION "\";\n") +set (VERSION "char const *RTL_AIRBAND_VERSION=\"${RTL_AIRBAND_VERSION}\";\n") if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) file(READ ${CMAKE_CURRENT_BINARY_DIR}/version.cpp VERSION_)