ExternalProject-verify.cmake.in 904 B

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