From 1aebe28f3833c4a90b8a24a242304f05360eb944 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= <gaetan.harter@fu-berlin.de>
Date: Mon, 6 Aug 2018 14:56:51 +0200
Subject: [PATCH] pkg/relic: check for minimal cmake version

relic does not build with cmake < 3.6.0. This checks for a minimal version
instead of failing to compile.

    cmake version 3.5.2 is not >= to minimal required 3.6.0

    Makefile:25: recipe for target '..cmake_version_supported' failed
---
 pkg/relic/Makefile | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pkg/relic/Makefile b/pkg/relic/Makefile
index c9c3296e77..7e2466c9dc 100644
--- a/pkg/relic/Makefile
+++ b/pkg/relic/Makefile
@@ -3,7 +3,10 @@ PKG_URL=https://github.com/relic-toolkit/relic.git
 PKG_VERSION=0b0442a8218df8d309266923f2dd5b9ae3b318ce
 PKG_LICENSE=LGPL-2.1
 
-.PHONY: all
+.PHONY: all ..cmake_version_supported
+
+CMAKE_MINIMAL_VERSION = 3.6.0
+
 
 CFLAGS += -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-function -Wno-newline-eof
 
@@ -22,6 +25,14 @@ $(PKG_BUILDDIR)/Makefile: $(TOOLCHAIN_FILE)
 $(TOOLCHAIN_FILE): git-download
 	$(RIOTTOOLS)/cmake/generate-xcompile-toolchain.sh > $(TOOLCHAIN_FILE)
 
+git-download: | ..cmake_version_supported
+
+..cmake_version_supported:
+	@ # Remove '-rcX' from version as they are not well handled
+	$(Q)\
+	CMAKE_VERSION=$$(cmake --version | sed -n '1 {s/cmake version //;s/-rc.*//;p;}'); \
+	$(RIOTTOOLS)/has_minimal_version/has_minimal_version.sh "$${CMAKE_VERSION}" "$(CMAKE_MINIMAL_VERSION)" cmake
+
 clean::
 	@rm -rf $(BINDIR)/$(PKG_NAME).a
 
-- 
GitLab