Don't try to clone strings repo if Git isn't available (fix #4357)

This can happen when the source code is downloaded as a .zip and the
Git command is not available to clone the strings repo.
This commit is contained in:
David Capello 2024-03-06 09:59:20 -03:00
parent 4584d67b69
commit 50d4f9d802

View File

@ -157,6 +157,8 @@ set(DATA_OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin/data)
include(FetchContent) include(FetchContent)
find_package(Git)
if(GIT_FOUND)
FetchContent_Declare( FetchContent_Declare(
clone_strings clone_strings
GIT_REPOSITORY https://github.com/aseprite/strings.git GIT_REPOSITORY https://github.com/aseprite/strings.git
@ -168,6 +170,9 @@ FetchContent_Declare(
TEST_COMMAND "") TEST_COMMAND "")
FetchContent_MakeAvailable(clone_strings) FetchContent_MakeAvailable(clone_strings)
add_custom_target(clone_strings DEPENDS clone_strings) add_custom_target(clone_strings DEPENDS clone_strings)
else()
add_custom_target(clone_strings)
endif()
###################################################################### ######################################################################
# Copy data/ directory target into bin/data/ # Copy data/ directory target into bin/data/
@ -182,6 +187,7 @@ foreach(fn ${src_data_files})
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/${fn}) list(APPEND out_data_files ${DATA_OUTPUT_DIR}/${fn})
endforeach() endforeach()
if(GIT_FOUND)
# Copy original en.ini to strings.git/en.ini to keep it updated. We # Copy original en.ini to strings.git/en.ini to keep it updated. We
# have to manually sync the "en.ini" file in the "strings" repo from # have to manually sync the "en.ini" file in the "strings" repo from
# the "aseprite" repo. # the "aseprite" repo.
@ -190,6 +196,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SOURCE_DATA_DIR}/strings/en.ini ${DATA_OUTPUT_DIR}/strings.git/en.ini COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SOURCE_DATA_DIR}/strings/en.ini ${DATA_OUTPUT_DIR}/strings.git/en.ini
MAIN_DEPENDENCY ${SOURCE_DATA_DIR}/strings/en.ini) MAIN_DEPENDENCY ${SOURCE_DATA_DIR}/strings/en.ini)
list(APPEND out_data_files ${DATA_OUTPUT_DIR}/strings.git/en.ini) list(APPEND out_data_files ${DATA_OUTPUT_DIR}/strings.git/en.ini)
endif()
add_custom_command( add_custom_command(
OUTPUT ${DATA_OUTPUT_DIR}/README.md OUTPUT ${DATA_OUTPUT_DIR}/README.md