summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject/hgclone.cmake.in
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-01-29 12:22:45 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-02-04 20:33:38 (GMT)
commit17e5516e608ba5c9c1f2dfad3d64f8f90874f108 (patch)
treeae0f88a262c3734cda45ee1040aee303e131d13d /Modules/ExternalProject/hgclone.cmake.in
parent4f3d1abbb4dca3d1e6b019471fa5d8be296492e3 (diff)
downloadCMake-17e5516e608ba5c9c1f2dfad3d64f8f90874f108.zip
CMake-17e5516e608ba5c9c1f2dfad3d64f8f90874f108.tar.gz
CMake-17e5516e608ba5c9c1f2dfad3d64f8f90874f108.tar.bz2
FetchContent: Invoke steps directly and avoid a separate sub-build
The cost of setting up and executing a separate sub-build to do the download, update and patch steps required for FetchContent population can be significant with some platforms and CMake generators. Avoid the sub-build altogether by invoking the step scripts directly. Previously, if no generator was set (e.g. population was being done in script mode), a generator needed to be available on the default PATH. Since we no longer use a sub-build, this restriction is also now gone. Fixes: #21703
Diffstat (limited to 'Modules/ExternalProject/hgclone.cmake.in')
-rw-r--r--Modules/ExternalProject/hgclone.cmake.in47
1 files changed, 30 insertions, 17 deletions
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
index 09395cc..5561955 100644
--- a/Modules/ExternalProject/hgclone.cmake.in
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -3,43 +3,56 @@
cmake_minimum_required(VERSION 3.5)
+set(quiet "@quiet@")
+set(script_dir "@CMAKE_CURRENT_FUNCTION_LIST_DIR@/ExternalProject")
+include(${script_dir}/captured_process_setup.cmake)
+
if(NOT "@hgclone_infofile@" IS_NEWER_THAN "@hgclone_stampfile@")
- message(STATUS "Avoiding repeated hg clone, stamp file is up to date: '@hgclone_stampfile@'")
+ if(NOT quiet)
+ message(STATUS
+ "Avoiding repeated hg clone, stamp file is up to date: "
+ "'@hgclone_stampfile@'"
+ )
+ endif()
return()
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E rm -rf "@source_dir@"
RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR "Failed to remove directory: '@source_dir@'")
-endif()
+ ${capture_output}
+)
+_ep_command_check_result(
+ error_code "Failed to remove directory: '@source_dir@'"
+)
execute_process(
COMMAND "@hg_EXECUTABLE@" clone -U "@hg_repository@" "@src_name@"
WORKING_DIRECTORY "@work_dir@"
RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR "Failed to clone repository: '@hg_repository@'")
-endif()
+ ${capture_output}
+)
+_ep_command_check_result(
+ error_code "Failed to clone repository: '@hg_repository@'"
+)
execute_process(
COMMAND "@hg_EXECUTABLE@" update @hg_tag@
WORKING_DIRECTORY "@work_dir@/@src_name@"
RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR "Failed to checkout tag: '@hg_tag@'")
-endif()
+ ${capture_output}
+)
+_ep_command_check_result(
+ error_code "Failed to checkout tag: '@hg_tag@'"
+)
# Complete success, update the script-last-run stamp file:
#
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "@hgclone_infofile@" "@hgclone_stampfile@"
RESULT_VARIABLE error_code
- )
-if(error_code)
- message(FATAL_ERROR "Failed to copy script-last-run stamp file: '@hgclone_stampfile@'")
-endif()
+ ${capture_output}
+)
+_ep_command_check_result(
+ error_code "Failed to copy script-last-run stamp file: '@hgclone_stampfile@'"
+)