Warning, /graphics/kphotoalbum/cmake/modules/GitDescription.cmake is written in an unsupported language. File is not indexed.
0001 # - GIT_GET_DESCRIPTION(description_variable [GIT_ARGS arg1 ...] [SEND_ERROR]) 0002 # This macro calls git describe to obtain a concise description of the current 0003 # git repository, i.e. the most recent tag, together with thea "distance" to 0004 # that tag and the short hash of the current commit. 0005 # 0006 # The description will be written into 'description_variable'. If an error 0007 # occurred, the variable will be set to '-NOTFOUND' unless SEND_ERROR is set. 0008 # In this case the a SEND_ERROR will be issued and generation will be skipped. 0009 # 0010 # Additional arguments to "git described" can be specified after the keyword 0011 # GIT_ARGS. 0012 # 0013 # Example invocation: 0014 # GIT_GET_DESCRIPTION(PROJECT_VERSION GIT_ARGS --dirty) 0015 # message(STATUS "Project is at revision ${PROJECT_VERSION}.") 0016 # 0017 # Assuming the project has been previously tagged with "1.0", there have been 2 0018 # commits since, and the working copy has been changed, this example could print 0019 # the following text: 0020 # -- Project is at revision 1.0-2-g58a35d9-dirty. 0021 # 0022 # Depends on CMakeParseArguments. 0023 ## 0024 0025 # SPDX-FileCopyrightText: 2012-2013,2022-2023 Johannes Zarl-Zierl <johannes@zarl-zierl.at> 0026 # 0027 # SPDX-License-Identifier: BSD-3-Clause 0028 0029 # FindGit is a standard module since cmake 2.8.2 0030 # CMakeParseArguments is included since cmake 2.8.3 0031 include(CMakeParseArguments) 0032 0033 ## git_get_description(<DESCRIPTION_VARIABLE> [GIT_ARGS <arg1>..<argN>] [SEND_ERROR]) 0034 # Write the result of "git describe" into the variable DESCRIPTION_VARIABLE. 0035 # Additional arguments to git describe(e.g. --dirty)can be passed using the keyword GIT_ARGS. 0036 # If SEND_ERROR is set, execution is immediately stopped when an error occurs. 0037 function(git_get_description DESCVAR) 0038 cmake_parse_arguments(_GGD "SEND_ERROR" "" "GIT_ARGS" "${ARGN}") 0039 if(SEND_ERROR) 0040 set(_severity SEND_ERROR) 0041 else() 0042 set(_severity WARNING) 0043 endif() 0044 0045 find_package(Git QUIET) 0046 if(NOT GIT_FOUND) 0047 message(${severity} "git_get_description: could not find package git!") 0048 set(${DESCVAR} "-NOTFOUND" PARENT_SCOPE) 0049 return() 0050 endif() 0051 0052 execute_process(COMMAND "${GIT_EXECUTABLE}" describe ${_GGD_GIT_ARGS} 0053 WORKING_DIRECTORY "${BASE_DIR}" 0054 RESULT_VARIABLE _gitresult 0055 OUTPUT_VARIABLE _gitdesc 0056 ERROR_VARIABLE _giterror 0057 OUTPUT_STRIP_TRAILING_WHITESPACE) 0058 0059 if(NOT _gitresult EQUAL 0) 0060 message(${_severity} "git_get_description: error during execution of git describe!") 0061 message(${_severity} "Error was: ${_giterror}") 0062 set(${DESCVAR} "-NOTFOUND" PARENT_SCOPE) 0063 else() 0064 set(${DESCVAR} "${_gitdesc}" PARENT_SCOPE) 0065 endif() 0066 endfunction() 0067 # vi:expandtab:tabstop=4 shiftwidth=4: