mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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
59 lines
1.5 KiB
CMake
59 lines
1.5 KiB
CMake
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
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("@LOCAL@" STREQUAL "")
|
|
message(FATAL_ERROR "LOCAL can't be empty")
|
|
endif()
|
|
|
|
if(NOT EXISTS "@LOCAL@")
|
|
message(FATAL_ERROR "File not found: @LOCAL@")
|
|
endif()
|
|
|
|
function(do_verify)
|
|
if("@ALGO@" STREQUAL "")
|
|
_ep_message_quiet_capture(WARNING
|
|
"File will not be verified since no URL_HASH specified"
|
|
)
|
|
set(accumulated_output "${accumulated_output}" PARENT_SCOPE)
|
|
return()
|
|
endif()
|
|
|
|
if("@EXPECT_VALUE@" STREQUAL "")
|
|
_ep_message_quiet_capture(FATAL_ERROR "EXPECT_VALUE can't be empty")
|
|
endif()
|
|
|
|
_ep_message_quiet_capture(STATUS
|
|
"verifying file...
|
|
file='@LOCAL@'"
|
|
)
|
|
set(accumulated_output "${accumulated_output}" PARENT_SCOPE)
|
|
|
|
file("@ALGO@" "@LOCAL@" actual_value)
|
|
|
|
if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
|
|
_ep_message_quiet_capture(FATAL_ERROR
|
|
"error: @ALGO@ hash of
|
|
@LOCAL@
|
|
does not match expected value
|
|
expected: '@EXPECT_VALUE@'
|
|
actual: '${actual_value}'
|
|
")
|
|
endif()
|
|
|
|
_ep_message_quiet_capture(STATUS "verifying file... done")
|
|
set(accumulated_output "${accumulated_output}" PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
do_verify()
|
|
|
|
set(extract_script "@extract_script_filename@")
|
|
if(NOT "${extract_script}" STREQUAL "")
|
|
include("${extract_script}")
|
|
endif()
|