31 lines
1.6 KiB
Diff
31 lines
1.6 KiB
Diff
From 5445921d0c3827758f3ad7946b9aa7b37d6d7d19 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C3=89rico=20Nogueira=20Rolim?=
|
|
<34201958+ericonr@users.noreply.github.com>
|
|
Date: Thu, 11 Feb 2021 18:19:20 -0300
|
|
Subject: [PATCH] cmake/Version: fix cross compilation.
|
|
|
|
It's a CMake weirdness, sometimes it can't find files when cross compiling unless that option is added.
|
|
---
|
|
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
|
|
index e80c400..e0dac25 100644
|
|
--- a/cmake/Version.cmake
|
|
+++ b/cmake/Version.cmake
|
|
@@ -1,7 +1,7 @@
|
|
cmake_minimum_required(VERSION 3.12)
|
|
find_program(GIT_EXECUTABLE git DOC "Git version control")
|
|
mark_as_advanced(GIT_EXECUTABLE)
|
|
-find_file(GITDIR NAMES .git PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH NO_PACKAGE_ROOT_PATH)
|
|
+find_file(GITDIR NAMES .git PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH NO_PACKAGE_ROOT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
|
if (GIT_EXECUTABLE AND GITDIR)
|
|
set(old_tz $ENV{TZ})
|
|
set(ENV{TZ} UTC)
|
|
@@ -36,7 +36,7 @@ if (GIT_EXECUTABLE AND GITDIR)
|
|
list(GET version_parts 1 GPICK_BUILD_DATE)
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/.version" "${GPICK_BUILD_VERSION}\n${GPICK_BUILD_REVISION}\n${GPICK_BUILD_HASH}\n${GPICK_BUILD_DATE}")
|
|
else()
|
|
- find_file(VERSION_FILE NAMES .version PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH NO_PACKAGE_ROOT_PATH)
|
|
+ find_file(VERSION_FILE NAMES .version PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH NO_PACKAGE_ROOT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
|
if (NOT VERSION_FILE)
|
|
message(FATAL_ERROR "Version file \".version\" is required when GIT can not be used to get version information.")
|
|
endif()
|