]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build: Improve detection av Ccache version from source repo
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 19 Aug 2021 18:34:43 +0000 (20:34 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 19 Aug 2021 18:43:27 +0000 (20:43 +0200)
When running CMake outside the source repository a plain git command
naturally won’t find the repository. Fix this by pointing git towards
the repository.

cmake/CcacheVersion.cmake

index 25fd7162000a4d28898f8510b0445e5ee7e43949..dadacd81a511f2182da1725536ccd239b32af6d1 100644 (file)
@@ -48,7 +48,7 @@ elseif(EXISTS "${CMAKE_SOURCE_DIR}/.git")
   else()
     macro(git)
       execute_process(
-        COMMAND "${GIT_EXECUTABLE}" ${ARGN}
+        COMMAND "${GIT_EXECUTABLE}" -C "${CMAKE_SOURCE_DIR}" ${ARGN}
         OUTPUT_VARIABLE git_stdout OUTPUT_STRIP_TRAILING_WHITESPACE
         ERROR_VARIABLE git_stderr ERROR_STRIP_TRAILING_WHITESPACE)
     endmacro()