[x265] [PATCH] CMake: fix generation of version info from .hg_archival.txt
David Christenson
mail at noctem.xyz
Sat Feb 3 07:06:09 CET 2018
# HG changeset patch
# User David Christenson <mail at noctem.xyz>
# Date 1517635098 25200
# Fri Feb 02 22:18:18 2018 -0700
# Node ID 2b5f3ebe01167dc90365a06ac25ff3caec4a9495
# Parent 1949157705cef7e6e97df116e2f71636f4cb0025
CMake: fix generation of version info from .hg_archival.txt
When building from a commit more recent than the latest tag, version.cmake
wouldn't set X265_LATEST_TAG and X265_TAG_DISTANCE resulting in their defaults
(0.0 and 0) being used. Also truncate the revision ID to 12 characters to match
the length used when parsing from the hg executable.
diff --git a/source/cmake/version.cmake b/source/cmake/version.cmake
--- a/source/cmake/version.cmake
+++ b/source/cmake/version.cmake
@@ -17,22 +17,21 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/..
foreach(f ${archive})
string(FIND "${f}" ": " pos)
string(SUBSTRING "${f}" 0 ${pos} key)
string(SUBSTRING "${f}" ${pos} -1 value)
string(SUBSTRING "${value}" 2 -1 value)
set(hg_${key} ${value})
endforeach()
if(DEFINED hg_tag)
- set(X265_VERSION ${hg_tag})
set(X265_LATEST_TAG ${hg_tag})
- set(X265_TAG_DISTANCE "0")
elseif(DEFINED hg_node)
- string(SUBSTRING "${hg_node}" 0 16 hg_id)
- set(X265_VERSION "${hg_latesttag}+${hg_latesttagdistance}-${hg_id}")
+ set(X265_LATEST_TAG ${hg_latesttag})
+ set(X265_TAG_DISTANCE ${hg_latesttagdistance})
+ string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)
endif()
elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)
if(EXISTS "${HG_EXECUTABLE}.bat")
# mercurial source installs on Windows require .bat extension
set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
endif()
message(STATUS "hg found at ${HG_EXECUTABLE}")
-------------- next part --------------
# HG changeset patch
# User David Christenson <mail at noctem.xyz>
# Date 1517635098 25200
# Fri Feb 02 22:18:18 2018 -0700
# Node ID 2b5f3ebe01167dc90365a06ac25ff3caec4a9495
# Parent 1949157705cef7e6e97df116e2f71636f4cb0025
CMake: fix generation of version info from .hg_archival.txt
When building from a commit more recent than the latest tag, version.cmake
wouldn't set X265_LATEST_TAG and X265_TAG_DISTANCE resulting in their defaults
(0.0 and 0) being used. Also truncate the revision ID to 12 characters to match
the length used when parsing from the hg executable.
diff --git a/source/cmake/version.cmake b/source/cmake/version.cmake
--- a/source/cmake/version.cmake
+++ b/source/cmake/version.cmake
@@ -17,22 +17,21 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/..
foreach(f ${archive})
string(FIND "${f}" ": " pos)
string(SUBSTRING "${f}" 0 ${pos} key)
string(SUBSTRING "${f}" ${pos} -1 value)
string(SUBSTRING "${value}" 2 -1 value)
set(hg_${key} ${value})
endforeach()
if(DEFINED hg_tag)
- set(X265_VERSION ${hg_tag})
set(X265_LATEST_TAG ${hg_tag})
- set(X265_TAG_DISTANCE "0")
elseif(DEFINED hg_node)
- string(SUBSTRING "${hg_node}" 0 16 hg_id)
- set(X265_VERSION "${hg_latesttag}+${hg_latesttagdistance}-${hg_id}")
+ set(X265_LATEST_TAG ${hg_latesttag})
+ set(X265_TAG_DISTANCE ${hg_latesttagdistance})
+ string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)
endif()
elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)
if(EXISTS "${HG_EXECUTABLE}.bat")
# mercurial source installs on Windows require .bat extension
set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
endif()
message(STATUS "hg found at ${HG_EXECUTABLE}")
More information about the x265-devel
mailing list