From 9568d5bb737eb468e87fd43f21404e2def101e30 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 12 Aug 2024 19:58:32 +0200 Subject: Display Git revision in docs generated from releases (#499) - makesrcdist: store Git revision in a file in the tarball - CMake/resources.cmake: get git revision either from Git or file and store it as CMake cache variable 'FLTK_GIT_REVISION' for reference - documentation/*: get git revision from git or file - fluid/documentation/*: get git revision from git or file --- documentation/CMakeLists.txt | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'documentation/CMakeLists.txt') diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt index cf9699449..150771a0d 100644 --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -1,7 +1,7 @@ # # CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org) # -# Copyright 1998-2023 by Bill Spitzak and others. +# Copyright 1998-2024 by Bill Spitzak and others. # # This library is free software. Distribution and use rights are outlined in # the file "COPYING" which should have been included with this file. If this @@ -16,7 +16,6 @@ set(DOCS) set(GENERATE_DOCS FALSE) -set(GIT_REVISION "") set(YEAR "") set(CURRENT_DATE "") @@ -49,28 +48,8 @@ if(GENERATE_DOCS) OUTPUT_STRIP_TRAILING_WHITESPACE ) - # find git revision - - # FIXME: This must also work with tarballs where git is not available. - # For now we just ignore errors and set GIT_REVISION = "unknown". - # In the future tarball/zip generation should create a file - # that contains the git revision. - - execute_process(COMMAND - git rev-parse --short=10 HEAD - OUTPUT_VARIABLE GIT_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${FLTK_SOURCE_DIR} - ERROR_QUIET - ) - - # set to "'unknown'" if git is not available - if(GIT_REVISION STREQUAL "") - set(GIT_REVISION "'unknown'") - endif() - # Find "short" doxygen version if it was built from Git - # Note: this is still needed in CMake 3.12.0 but later CMake versions + # Note: this is still needed in CMake 3.15 but later CMake versions # (notably 3.25) remove the Git revision in 'DOXYGEN_VERSION'. # Todo: Find the "first good" CMake version and remove this redundant # code once we require this as our minimal version and replace the @@ -98,7 +77,7 @@ if(GENERATE_DOCS) if(0) # debug fl_debug_var(YEAR) fl_debug_var(CURRENT_DATE) - fl_debug_var(GIT_REVISION) + fl_debug_var(FLTK_GIT_REVISION) fl_debug_var(DOXYGEN_FOUND) fl_debug_var(DOXYGEN_EXECUTABLE) fl_debug_var(DOXYGEN_VERSION) -- cgit v1.2.3