Only use FetchContent on CMake >= 3.11

This commit is contained in:
Adam Gashlin 2022-03-22 13:07:44 -07:00
parent b3d4dba7e0
commit ea45158d7d

View File

@ -1,8 +1,11 @@
set(FetchContent_INCLUDED FALSE)
if(NOT WIN32)
find_package(Git QUIET)
find_package(Subversion QUIET)
if(Git_FOUND OR Subversion_FOUND)
# no FetchContent until 3.11
if((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0") AND (Git_FOUND OR Subversion_FOUND))
include(FetchContent)
set(FetchContent_INCLUDED TRUE)
endif()
endif()
@ -42,7 +45,7 @@ function(FetchDependency name)
else()
message(FATAL_ERROR "The provided path to ${ARGS_DIR} does not exist (Use ${name}_PATH)")
endif()
elseif((Subversion_FOUND AND ARGS_SVN_REPOSITORY) OR (Git_FOUND AND ARGS_GIT_REPOSITORY) OR (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0" AND ARGS_FILE_DOWNLOAD))
elseif(FetchContent_INCLUDED AND ((Subversion_FOUND AND ARGS_SVN_REPOSITORY) OR (Git_FOUND AND ARGS_GIT_REPOSITORY) OR (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0" AND ARGS_FILE_DOWNLOAD)))
set(${name}_PATH ${VGM_SOURCE_DIR}/dependencies/${ARGS_DIR})
set(${name}_PATH ${${name}_PATH} PARENT_SCOPE)
set(${name}_SOURCE "(download)" PARENT_SCOPE)