Browse Source

HunterInit.cmake : download gate to CMAKE_BINARY_DIR / check status / check signature

pull/298/head
Pascal Thomet 8 years ago
parent
commit
1af4ef0265
  1. 1
      package/hunter/.gitignore
  2. 28
      package/hunter/HunterInit.cmake

1
package/hunter/.gitignore vendored

@ -1 +0,0 @@
HunterGate.cmake

28
package/hunter/HunterInit.cmake

@ -1,13 +1,31 @@
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake)
set(hunter_gate_file ${CMAKE_BINARY_DIR}/HunterGate.cmake)
if(NOT EXISTS ${hunter_gate_file})
set(url https://raw.githubusercontent.com/hunter-packages/gate/c4e5b3e4d1c97fb46ae86af7f59baac95f7f1cf0/cmake/HunterGate.cmake)
message("hunter_gate_file=${hunter_gate_file}")
set(expected_sha256 "9952fdeb6909855c7802938914d45dffa5e1b87252d4b4a6e9d54421dffe649f")
file(
DOWNLOAD
https://raw.githubusercontent.com/hunter-packages/gate/c4e5b3e4d1c97fb46ae86af7f59baac95f7f1cf0/cmake/HunterGate.cmake
${CMAKE_CURRENT_LIST_DIR}//HunterGate.cmake
DOWNLOAD ${url}
${hunter_gate_file}
STATUS status
)
list(GET status 0 status_code)
list(GET status 1 status_string)
if(status_code EQUAL 0)
file(SHA256 ${hunter_gate_file} computed_sha256)
if (NOT ${computed_sha256} STREQUAL ${expected_sha256})
message(FATAL_ERROR "HunterInit.cmake ; error downloading ${url} -> bad signature !")
endif()
else()
message(FATAL_ERROR "HunterInit.cmake : error downloading ${url}
status : ${status_code}
status_string : ${status_string}
")
endif()
endif()
# FIXME : will need to replace this url with the main hunter url !
include("${CMAKE_CURRENT_LIST_DIR}/HunterGate.cmake")
include("${CMAKE_BINARY_DIR}/HunterGate.cmake")
HunterGate(
URL "https://github.com/pthom/hunter/archive/hunter_magnum_rc4.tar.gz"
SHA1 "31554df9e988f27f4daa9f4df9529d75007500bf"

Loading…
Cancel
Save