Skip to content

Commit 4f3ccc9

Browse files
committed
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 #54
1 parent d2535e6 commit 4f3ccc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/OpusFilePackageVersion.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
6060
# fail to parse version from git and package version
6161
message(WARNING "Could not get package version.")
6262
set(OPUSFILE_PACKAGE_VERSION 0)
63-
set(OPUSFILE_PROJECT_VERSION 0)
63+
set(OPUSFILE_PROJECT_VERSION 0.0)
6464
endif()
6565

6666
message(STATUS "Opus project version: ${OPUSFILE_PROJECT_VERSION}")

0 commit comments

Comments
 (0)