https://github.com/Kitware/CMake
Raw File
Tip revision: c5dcd31e92c0a09009a340e3fe23ced4f6190b64 authored by Brad King on 07 September 2016, 12:55:56 UTC
CMake 3.6.2
Tip revision: c5dcd31
ExternalProject-verify.cmake.in
#=============================================================================
# Copyright 2008-2013 Kitware, Inc.
# Copyright 2016 Ruslan Baratov
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

cmake_minimum_required(VERSION 3.5)

if("@LOCAL@" STREQUAL "")
  message(FATAL_ERROR "LOCAL can't be empty")
endif()

if(NOT EXISTS "@LOCAL@")
  message(FATAL_ERROR "File not found: @LOCAL@")
endif()

if("@ALGO@" STREQUAL "")
  message(WARNING "File will not be verified since no URL_HASH specified")
  return()
endif()

if("@EXPECT_VALUE@" STREQUAL "")
  message(FATAL_ERROR "EXPECT_VALUE can't be empty")
endif()

message(STATUS "verifying file...
     file='@LOCAL@'")

file("@ALGO@" "@LOCAL@" actual_value)

if(NOT "${actual_value}" STREQUAL "@EXPECT_VALUE@")
  message(FATAL_ERROR "error: @ALGO@ hash of
  @LOCAL@
does not match expected value
  expected: '@EXPECT_VALUE@'
    actual: '${actual_value}'
")
endif()

message(STATUS "verifying file... done")
back to top