From 1236590507c38ae85847257e41776d0a9935024b Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Fri, 29 May 2020 21:14:47 +1000 Subject: FetchContent: Pass through CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY if set This was missed when the initial support was added in commit 0aea435aa1 (ExternalProject: Provide choice of git update strategies, 2020-02-12) --- Modules/FetchContent.cmake | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 69f2513..e05ca96 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -930,16 +930,16 @@ ExternalProject_Add_Step(${contentName}-populate copyfile endif() if(CMAKE_GENERATOR) - set(generatorOpts "-G${CMAKE_GENERATOR}") + set(subCMakeOpts "-G${CMAKE_GENERATOR}") if(CMAKE_GENERATOR_PLATFORM) - list(APPEND generatorOpts "-A${CMAKE_GENERATOR_PLATFORM}") + list(APPEND subCMakeOpts "-A${CMAKE_GENERATOR_PLATFORM}") endif() if(CMAKE_GENERATOR_TOOLSET) - list(APPEND generatorOpts "-T${CMAKE_GENERATOR_TOOLSET}") + list(APPEND subCMakeOpts "-T${CMAKE_GENERATOR_TOOLSET}") endif() if(CMAKE_MAKE_PROGRAM) - list(APPEND generatorOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") + list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") endif() else() @@ -947,7 +947,12 @@ ExternalProject_Add_Step(${contentName}-populate copyfile # generator is set (and hence CMAKE_MAKE_PROGRAM could not be # trusted even if provided). We will have to rely on being # able to find the default generator and build tool. - unset(generatorOpts) + unset(subCMakeOpts) + endif() + + if(DEFINED CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY) + list(APPEND subCMakeOpts + "-DCMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY=${CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY}") endif() # Create and build a separate CMake project to carry out the population. @@ -958,7 +963,7 @@ ExternalProject_Add_Step(${contentName}-populate copyfile configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/FetchContent/CMakeLists.cmake.in" "${ARG_SUBBUILD_DIR}/CMakeLists.txt") execute_process( - COMMAND ${CMAKE_COMMAND} ${generatorOpts} . + COMMAND ${CMAKE_COMMAND} ${subCMakeOpts} . RESULT_VARIABLE result ${outputOptions} WORKING_DIRECTORY "${ARG_SUBBUILD_DIR}" -- cgit v0.12