0002-cmake-Modules-Version.cmake-don-t-use-Git-version-if.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From feb5d9c6b7bcec788f9b01781c205e31fff260e7 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Tue, 11 Aug 2020 23:07:08 +0200
  4. Subject: [PATCH] cmake/Modules/Version.cmake: don't use Git version if not in
  5. a Git repo
  6. If the librtlsdr code comes from a tarball, it doesn't have any .git/
  7. metadata, and therefore even if Git (as a tool) is found, the logic in
  8. cmake/Modules/Version.cmake fails finding a version through Git:
  9. -- Extracting version information from git describe...
  10. fatal: Not a git repository (or any of the parent directories): .git
  11. As a consequence, the VERSION variable is empty, which later causes
  12. cmake to bail out with:
  13. CMake Error at /home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
  14. No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
  15. Call Stack (most recent call first):
  16. /home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/CMakePackageConfigHelpers.cmake:225 (write_basic_config_version_file)
  17. CMakeLists.txt:173 (write_basic_package_version_file)
  18. To avoid this, we only use Git to determine the version if the cmake
  19. project top-level source directory has a .git/ folder.
  20. Upstream: https://github.com/librtlsdr/librtlsdr/pull/75
  21. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  22. ---
  23. cmake/Modules/Version.cmake | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. diff --git a/cmake/Modules/Version.cmake b/cmake/Modules/Version.cmake
  26. index 2d4e76d..6f67fa4 100644
  27. --- a/cmake/Modules/Version.cmake
  28. +++ b/cmake/Modules/Version.cmake
  29. @@ -32,7 +32,7 @@ set(PATCH_VERSION ${VERSION_INFO_PATCH_VERSION})
  30. ########################################################################
  31. find_package(Git QUIET)
  32. -if(GIT_FOUND)
  33. +if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
  34. message(STATUS "Extracting version information from git describe...")
  35. execute_process(
  36. COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=4 --long
  37. --
  38. 2.26.2