@@ -133,10 +133,14 @@ function(hunter_gate_self root version sha1 result)
133133
134134 string (SUBSTRING "${sha1} " 0 7 archive_id)
135135
136- set (
137- hunter_self
138- "${root} /_Base/Download/Hunter/${version} /${archive_id} /Unpacked"
139- )
136+ if (EXISTS "${root} /cmake/Hunter" )
137+ set (hunter_self "${root} " )
138+ else ()
139+ set (
140+ hunter_self
141+ "${root} /_Base/Download/Hunter/${version} /${archive_id} /Unpacked"
142+ )
143+ endif ()
140144
141145 set ("${result} " "${hunter_self} " PARENT_SCOPE )
142146endfunction ()
@@ -490,37 +494,44 @@ macro(HunterGate)
490494 )
491495
492496 set (_master_location "${_hunter_self} /cmake/Hunter" )
493- get_filename_component (_archive_id_location "${_hunter_self} /.." ABSOLUTE )
494- set (_done_location "${_archive_id_location} /DONE" )
495- set (_sha1_location "${_archive_id_location} /SHA1" )
496-
497- # Check Hunter already downloaded by HunterGate
498- if (NOT EXISTS "${_done_location} " )
499- hunter_gate_download ("${_archive_id_location} " )
500- endif ()
497+ if (EXISTS "${HUNTER_GATE_ROOT} /cmake/Hunter" )
498+ # Hunter downloaded manually (e.g. by 'git clone')
499+ set (_unused "xxxxxxxxxx" )
500+ set (HUNTER_GATE_SHA1 "${_unused} " )
501+ set (HUNTER_GATE_VERSION "${_unused} " )
502+ else ()
503+ get_filename_component (_archive_id_location "${_hunter_self} /.." ABSOLUTE )
504+ set (_done_location "${_archive_id_location} /DONE" )
505+ set (_sha1_location "${_archive_id_location} /SHA1" )
506+
507+ # Check Hunter already downloaded by HunterGate
508+ if (NOT EXISTS "${_done_location} " )
509+ hunter_gate_download ("${_archive_id_location} " )
510+ endif ()
501511
502- if (NOT EXISTS "${_done_location} " )
503- hunter_gate_internal_error ("hunter_gate_download failed" )
504- endif ()
512+ if (NOT EXISTS "${_done_location} " )
513+ hunter_gate_internal_error ("hunter_gate_download failed" )
514+ endif ()
505515
506- if (NOT EXISTS "${_sha1_location} " )
507- hunter_gate_internal_error ("${_sha1_location} not found" )
508- endif ()
509- file (READ "${_sha1_location} " _sha1_value )
510- string (COMPARE EQUAL "${_sha1_value} " "${HUNTER_GATE_SHA1} " _is_equal)
511- if (NOT _is_equal)
512- hunter_gate_internal_error (
513- "Short SHA1 collision:"
514- " ${_sha1_value} (from ${_sha1_location} )"
515- " ${HUNTER_GATE_SHA1} (HunterGate)"
516- )
517- endif ()
518- if (NOT EXISTS "${_master_location} " )
519- hunter_gate_user_error (
520- "Master file not found:"
521- " ${_master_location} "
522- "try to update Hunter/HunterGate"
523- )
516+ if (NOT EXISTS "${_sha1_location} " )
517+ hunter_gate_internal_error ("${_sha1_location} not found" )
518+ endif ()
519+ file (READ "${_sha1_location} " _sha1_value )
520+ string (COMPARE EQUAL "${_sha1_value} " "${HUNTER_GATE_SHA1} " _is_equal)
521+ if (NOT _is_equal)
522+ hunter_gate_internal_error (
523+ "Short SHA1 collision:"
524+ " ${_sha1_value} (from ${_sha1_location} )"
525+ " ${HUNTER_GATE_SHA1} (HunterGate)"
526+ )
527+ endif ()
528+ if (NOT EXISTS "${_master_location} " )
529+ hunter_gate_user_error (
530+ "Master file not found:"
531+ " ${_master_location} "
532+ "try to update Hunter/HunterGate"
533+ )
534+ endif ()
524535 endif ()
525536 include ("${_master_location} " )
526537 set_property (GLOBAL PROPERTY HUNTER_GATE_DONE YES )
0 commit comments