Coin,

I rewrote things a bit, so as to match the current variable names policy. I also removed the unconditional versionned B-D, even if oldstable has 2.4.5 available, as adding unneeded versioning proved to do much harm in the past, mostly in case of porting.

One problem remains: the automatic version discovery will be working until the cmake package needs to use epochs. It is possible to auto-discover the epoch to use, but that would either means having network connectivity (rmadison), or proper sources.list and updated local database (apt-cache), but we can't count on this during autobuilders' work. Thus the user would have to add the version by himself, or modify the version like this:
  DEB_CMAKE_VERSION = <epoch>:$(DEB_CMAKE_VERSION)
which is a bit ugly and would give bullshit if cmake_minimum_required is missing or not formated correctly. But we could detect this situation.

Any suggestion ?

--
Marc Dequènes (Duck)
diff --git a/1/class/cmake.mk.in b/1/class/cmake.mk.in
index 2ed51dc..f0b8f5f 100644
--- a/1/class/cmake.mk.in
+++ b/1/class/cmake.mk.in
@@ -42,6 +42,18 @@ CMAKE = cmake
 DEB_CMAKE_INSTALL_PREFIX = /usr
 DEB_CMAKE_NORMAL_ARGS = -DCMAKE_INSTALL_PREFIX="$(DEB_CMAKE_INSTALL_PREFIX)" -DCMAKE_C_COMPILER:FILEPATH="$(CC)" -DCMAKE_CXX_COMPILER:FILEPATH="$(CXX)" -DCMAKE_C_FLAGS="$(CFLAGS)" -DCMAKE_CXX_FLAGS="$(CXXFLAGS)" -DCMAKE_SKIP_RPATH=ON -DCMAKE_VERBOSE_MAKEFILE=ON
 
+cdbs_cmake_minimum_required := $(shell find -type f -name CMakelists.txt | grep -o 'cmake_minimum_required\(.*\)' | grep -oE '[[:digit:]\.]*' | sort -n | tail -1 -)
+ifndef DEB_CMAKE_VERSION
+	ifneq (, $(cdbs_cmake_minimum_required))
+		DEB_CMAKE_VERSION = $(cdbs_cmake_minimum_required)
+	endif
+endif
+ifndef DEB_CMAKE_VERSION
+	CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), cmake
+else
+	CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), cmake (>= $(DEB_CMAKE_VERSION))
+endif
+
 common-configure-arch common-configure-indep:: common-configure-impl
 common-configure-impl:: $(DEB_BUILDDIR)/CMakeCache.txt
 $(DEB_BUILDDIR)/CMakeCache.txt:

Attachment: pgpCeWbgDQ8ka.pgp
Description: PGP Digital Signature

Reply via email to