[x265] [PATCH] cmake: use CMAKE_CURRENT_SOURCE_DIR as location to run hg commands find a version

Steve Borho steve at borho.org
Wed Mar 25 14:28:54 CET 2015


On 03/25, gopu at multicorewareinc.com wrote:
> # HG changeset patch
> # User Gopu Govindaswamy <gopu at multicorewareinc.com>
> # Date 1427272103 -19800
> #      Wed Mar 25 13:58:23 2015 +0530
> # Node ID 3a68c8aa4bb993032a5ad5dc765c6ceac46ce507
> # Parent  e637273e2ae6391d43a037d9a4298a8be8e178ad
> cmake: use CMAKE_CURRENT_SOURCE_DIR as location to run hg commands find a version

queued

> diff -r e637273e2ae6 -r 3a68c8aa4bb9 source/cmake/version.cmake
> --- a/source/cmake/version.cmake	Tue Mar 24 15:31:05 2015 -0500
> +++ b/source/cmake/version.cmake	Wed Mar 25 13:58:23 2015 +0530
> @@ -10,9 +10,9 @@
>  set(X265_LATEST_TAG "0.0")
>  set(X265_TAG_DISTANCE "0")
>  
> -if(EXISTS ${CMAKE_SOURCE_DIR}/../.hg_archival.txt)
> +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)
>      # read the lines of the archive summary file to extract the version
> -    file(READ ${CMAKE_SOURCE_DIR}/../.hg_archival.txt archive)
> +    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)
>      STRING(REGEX REPLACE "\n" ";" archive "${archive}")
>      foreach(f ${archive})
>          string(FIND "${f}" ": " pos)
> @@ -29,7 +29,7 @@
>          string(SUBSTRING "${hg_node}" 0 16 hg_id)
>          set(X265_VERSION "${hg_latesttag}+${hg_latesttagdistance}-${hg_id}")
>      endif()
> -elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/../.hg)
> +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")
> @@ -38,14 +38,14 @@
>  
>      execute_process(COMMAND
>          ${HG_EXECUTABLE} log -r. --template "{latesttag}"
> -        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>          OUTPUT_VARIABLE X265_LATEST_TAG
>          ERROR_QUIET
>          OUTPUT_STRIP_TRAILING_WHITESPACE
>          )
>      execute_process(COMMAND
>          ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"
> -        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>          OUTPUT_VARIABLE X265_TAG_DISTANCE
>          ERROR_QUIET
>          OUTPUT_STRIP_TRAILING_WHITESPACE
> @@ -53,7 +53,7 @@
>      execute_process(
>          COMMAND
>          ${HG_EXECUTABLE} log -r. --template "{node|short}"
> -        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>          OUTPUT_VARIABLE HG_REVISION_ID
>          ERROR_QUIET
>          OUTPUT_STRIP_TRAILING_WHITESPACE
> @@ -67,11 +67,11 @@
>      else()
>          set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${HG_REVISION_ID}")
>      endif()
> -elseif(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/../.git)
> +elseif(GIT_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
>      execute_process(
>          COMMAND
>          ${GIT_EXECUTABLE} describe --tags --abbrev=0
> -        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>          OUTPUT_VARIABLE X265_LATEST_TAG
>          ERROR_QUIET
>          OUTPUT_STRIP_TRAILING_WHITESPACE
> @@ -80,7 +80,7 @@
>      execute_process(
>          COMMAND
>          ${GIT_EXECUTABLE} describe --tags
> -        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
>          OUTPUT_VARIABLE X265_VERSION
>          ERROR_QUIET
>          OUTPUT_STRIP_TRAILING_WHITESPACE
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list