shithub: opusfile

Download patch

ref: 24d6e752b8c8c82e46231c74b0e4146b3d189216
parent: 68030a507962284d583416ee37f9a8e580bf369f
author: Ralph Giles <giles@thaumas.net>
date: Tue Apr 22 16:27:45 EDT 2025

cmake: Fix fallback version number

OpusFilePackageVersion falls back to returning version 0 if
it cannot find an actual version number from git or a release.

However, CMakeLists.txt assumes the package version is at
least a two part x.y version number and so fails trying
to parse out the minor revision number when run from a
bare directory:

    Opus Project version: 0
    CMake Error at CMakeLists.txt:9 (list):
      list index: 1 out of range (-1, 0)

Instead, return 0.0 as the project version. Addresses an
issue raised in https://github.com/xiph/opusfile/issues/54

Signed-off-by: Tristan Matthews <tmatth@videolan.org>

--- a/cmake/OpusFilePackageVersion.cmake
+++ b/cmake/OpusFilePackageVersion.cmake
@@ -60,7 +60,7 @@
     # fail to parse version from git and package version
     message(WARNING "Could not get package version.")
     set(OPUSFILE_PACKAGE_VERSION 0)
-    set(OPUSFILE_PROJECT_VERSION 0)
+    set(OPUSFILE_PROJECT_VERSION 0.0)
   endif()
 
   message(STATUS "Opus project version: ${OPUSFILE_PROJECT_VERSION}")
--