Skip to content

Commit

Permalink
Revert "Remove git based support for testing examples" (cpp-pm#170)
Browse files Browse the repository at this point in the history
This reverts commit 7312c58.
  • Loading branch information
NeroBurner authored Mar 6, 2020
1 parent 8099384 commit 9f8b445
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions examples/common.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2013, 2015, 2019 Ruslan Baratov
# Copyright (c) 2013, 2015 Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.0)

### Include HunterGate module from git submodule
set(gate_dir "${CMAKE_CURRENT_LIST_DIR}/../gate")
Expand All @@ -18,27 +18,17 @@ endif()
message("Including HunterGate: ${gate_module}")
include("${gate_module}")

set(
error_message
"Are you using jenkins.py script for testing?
Please check:
- https://hunter.readthedocs.io/en/latest/creating-new/create/cmake.html#testing-locally"
)

### Check testing variables are set
if("${TESTING_URL}" STREQUAL "")
message(FATAL_ERROR "TESTING_URL is empty. ${error_message}")
endif()

if("${TESTING_SHA1}" STREQUAL "")
message(FATAL_ERROR "TESTING_SHA1 is empty. ${error_message}")
string(COMPARE EQUAL "${TESTING_URL}" "" url_is_empty)
string(COMPARE EQUAL "${TESTING_SHA1}" "" sha1_is_empty)
string(COMPARE EQUAL "${HUNTER_ROOT}" "" hunter_root_is_empty)

if(NOT url_is_empty AND NOT sha1_is_empty AND NOT hunter_root_is_empty)
get_filename_component(TESTING_URL "${TESTING_URL}" ABSOLUTE)

### HunterGate module
HunterGate(URL "${TESTING_URL}" SHA1 "${TESTING_SHA1}" ${TESTING_CONFIG_OPT})
else()
get_filename_component(HUNTER_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
HunterGate(URL "x" SHA1 "xxxxxxxx" ${TESTING_CONFIG_OPT})
endif()

if("${HUNTER_ROOT}" STREQUAL "")
message(FATAL_ERROR "HUNTER_ROOT is empty. ${error_message}")
endif()

get_filename_component(TESTING_URL "${TESTING_URL}" ABSOLUTE)

### HunterGate module
HunterGate(URL "${TESTING_URL}" SHA1 "${TESTING_SHA1}" ${TESTING_CONFIG_OPT})

0 comments on commit 9f8b445

Please sign in to comment.