1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4cmake_minimum_required(VERSION 3.5) 5 6if("@LOCAL@" STREQUAL "") 7 message(FATAL_ERROR "LOCAL can't be empty") 8endif() 9 10if(NOT EXISTS "@LOCAL@") 11 message(FATAL_ERROR "File not found: @LOCAL@") 12endif() 13 14if("@ALGO@" STREQUAL "") 15 message(WARNING "File will not be verified since no URL_HASH specified") 16 return() 17endif() 18 19if("@EXPECT_VALUE@" STREQUAL "") 20 message(FATAL_ERROR "EXPECT_VALUE can't be empty") 21endif() 22 23message(STATUS "verifying file... 24 file='@LOCAL@'") 25 26file("@ALGO@" "@LOCAL@" actual_value) 27 28if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@") 29 message(FATAL_ERROR "error: @ALGO@ hash of 30 @LOCAL@ 31does not match expected value 32 expected: '@EXPECT_VALUE@' 33 actual: '${actual_value}' 34") 35endif() 36 37message(STATUS "verifying file... done") 38