/usr/lib/cmake/paraview/ParaViewDetermineVersion.cmake is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #=========================================================================
#
# Program: ParaView
#
# Copyright (c) Kitware, Inc.
# All rights reserved.
# See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notice for more information.
#
#=========================================================================
# Used to determine the version for ParaView source using "git describe", if git
# is found. On success sets following variables in caller's scope:
# ${var_prefix}_VERSION
# ${var_prefix}_VERSION_MAJOR
# ${var_prefix}_VERSION_MINOR
# ${var_prefix}_VERSION_PATCH
# ${var_prefix}_VERSION_PATCH_EXTRA
# ${var_prefix}_VERSION_FULL
# ${var_prefix}_VERSION_IS_RELEASE is patch-extra is empty.
#
# If git is not found, or git describe cannot be run successfully, then these
# variables are left unchanged and status message is printed.
#
# Arguments are:
# source_dir : Source directory
# git_command : git executable
# var_prefix : prefix for variables e.g. "PARAVIEW".
function(determine_version source_dir git_command var_prefix)
set (major)
set (minor)
set (patch)
set (full)
set (patch_extra)
set (result -1)
if (NOT PARAVIEW_GIT_DESCRIBE)
if (EXISTS ${git_command})
execute_process(
COMMAND ${git_command} describe
WORKING_DIRECTORY ${source_dir}
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
endif()
else()
set(result 0)
set(output ${PARAVIEW_GIT_DESCRIBE})
endif()
if (${result} EQUAL 0)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-]*(.*)"
version_matches "${output}")
if (CMAKE_MATCH_0)
message(STATUS "Determined Source Version : ${CMAKE_MATCH_0}")
set (full ${CMAKE_MATCH_0})
set (major ${CMAKE_MATCH_1})
set (minor ${CMAKE_MATCH_2})
set (patch ${CMAKE_MATCH_3})
set (patch_extra ${CMAKE_MATCH_4})
endif()
endif()
if (full)
set (${var_prefix}_VERSION "${major}.${minor}" PARENT_SCOPE)
set (${var_prefix}_VERSION_MAJOR ${major} PARENT_SCOPE)
set (${var_prefix}_VERSION_MINOR ${minor} PARENT_SCOPE)
set (${var_prefix}_VERSION_PATCH ${patch} PARENT_SCOPE)
set (${var_prefix}_VERSION_PATCH_EXTRA ${patch_extra} PARENT_SCOPE)
set (${var_prefix}_VERSION_FULL ${full} PARENT_SCOPE)
if ("${major}.${minor}.${patch}" EQUAL "${full}")
set (${var_prefix}_VERSION_IS_RELEASE TRUE PARENT_SCOPE)
else ()
set (${var_prefix}_VERSION_IS_RELEASE FALSE PARENT_SCOPE)
endif()
else()
message(STATUS
"Could not use git to determine source version, using version ${${var_prefix}_VERSION_FULL}"
)
endif()
endfunction()
|