1 Star 0 Fork 8

天涯云海/manticoresearch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sphinxrevcheck.cmake 1.91 KB
一键复制 编辑 原始数据 按行查看 历史
alexey 提交于 2022-06-10 18:34 . dumb autoformat of all cmake files
cmake_minimum_required ( VERSION 3.17 )
# this file included by cpack config in order to detect if configured and build version are the same
# guess version strings from current git repo
function ( guess_from_git )
if (NOT EXISTS "${MANTICORE_SOURCE_DIR}/.git")
return ()
endif ()
find_package ( Git QUIET )
if (NOT GIT_FOUND)
return ()
endif ()
# extract short has as CHECK_GIT_COMMIT_ID
execute_process ( COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h
WORKING_DIRECTORY "${MANTICORE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE CHECK_GIT_COMMIT_ID
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE )
set ( CHECK_GIT_COMMIT_ID "${CHECK_GIT_COMMIT_ID}" PARENT_SCOPE )
endfunction ()
# guess version strings from template header file (git archive mark it there)
function ( extract_from_git_slug HEADER )
if (EXISTS "${HEADER}")
FILE ( STRINGS "${HEADER}" _CONTENT )
foreach (LINE ${_CONTENT})
# match definitions like - // GIT_*_ID VALUE
if ("${LINE}" MATCHES "^//[ \t]+(GIT_.*_ID)[ \t]\"(.*)\"")
set ( ${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" )
endif ()
endforeach ()
if (GIT_COMMIT_ID STREQUAL "$Format:%h$")
return () # no slug
endif ()
# commit id
set ( CHECK_GIT_COMMIT_ID "${GIT_COMMIT_ID}" PARENT_SCOPE )
endif ()
endfunction ()
# function definitions finished, execution starts from here
##################################
# first try to use binary git
guess_from_git ()
# 2-nd try - if we build from git archive. Correct hash and date provided then, but no branch
if (NOT CHECK_GIT_COMMIT_ID)
extract_from_git_slug ( "${MANTICORE_SOURCE_DIR}/src/sphinxversion.h.in" )
endif ()
if (NOT CHECK_GIT_COMMIT_ID)
set ( CHECK_GIT_COMMIT_ID "DEADBEEF" )
endif ()
if (NOT CHECK_GIT_COMMIT_ID STREQUAL "${CONFIGURED_GIT_COMMIT_ID}")
message ( FATAL_ERROR "Current commit ${CHECK_GIT_COMMIT_ID} is differs from stored ${CONFIGURED_GIT_COMMIT_ID}. Run 'cmake .' in build dir to fix" )
endif ()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/tianyayunhai/manticoresearch.git
git@gitee.com:tianyayunhai/manticoresearch.git
tianyayunhai
manticoresearch
manticoresearch
master

搜索帮助