From: Antoine Fontaine Date: Thu, 10 Feb 2022 21:14:17 +0000 (+0100) Subject: Make git dependency optional if GIT_VERSION is set X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7a528d7248a70aff1c54e5f508de56bfffbf24c3;p=xonotic%2Fnetradiant.git Make git dependency optional if GIT_VERSION is set --- diff --git a/CMakeLists.txt b/CMakeLists.txt index be945731..d865faf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,19 +148,21 @@ set(RADIANT_VERSION "${RADIANT_VERSION_MAJOR}.${RADIANT_VERSION_MINOR}.${RADIANT set(RADIANT_ABOUTMSG "Custom build" CACHE STRING "About message") -find_package(Git REQUIRED) +set(RADIANT_VERSION_STRING "${RADIANT_VERSION}n") -execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE -) +if (NOT DEFINED GIT_VERSION) + find_package(Git REQUIRED) -set(RADIANT_VERSION_STRING "${RADIANT_VERSION}n") + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) -if (GIT_VERSION) - set(RADIANT_VERSION_STRING "${RADIANT_VERSION_STRING}-git-${GIT_VERSION}") + if (GIT_VERSION) + set(RADIANT_VERSION_STRING "${RADIANT_VERSION_STRING}-git-${GIT_VERSION}") + endif () endif () message(STATUS "Building ${PROJECT_NAME} ${RADIANT_VERSION_STRING} ${RADIANT_ABOUTMSG}")