[Buildroot] [RFC] support/dependencies: introduce BR2_HOST_CMAKE_AT_LEAST
Romain Naour
romain.naour at gmail.com
Sat Jun 3 22:16:12 UTC 2023
libjxl requires cmake 3.19 since version v0.7 due to the
new behavior of cmake [1].
-- Configuring done
CMake Error at cmake/FindLCMS2.cmake:40 (add_library):
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "INCLUDE_DIRECTORIES" is not allowed.
Call Stack (most recent call first):
third_party/CMakeLists.txt:114 (find_package)
The portability issue has already been reported upstream [2].
host-cmake is know to take a long time to build and we want
to avoid bumping BR2_CMAKE_VERSION_MIN only for one package.
As discussed on the mailing list [3] introduce
BR2_HOST_CMAKE_AT_LEAST_X_Y selected by package that
requires a higher cmake version than the one provided by
the host.
Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/4322819095
[1] https://gitlab.kitware.com/cmake/cmake/-/commit/afb998704e67d3d3ce5b24c112cb06e770fca78d
[2] https://github.com/libjxl/libjxl/issues/1425
[3] http://lists.busybox.net/pipermail/buildroot/2023-June/668287.html
Signed-off-by: Romain Naour <romain.naour at gmail.com>
Cc: Julien Olivain <ju.o at free.fr>
Cc: Arnout Vandecappelle <arnout at mind.be>
Cc: Peter Korsgaard <peter at korsgaard.com>
Cc: Yann E. MORIN <yann.morin.1998 at free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
package/cmake/Config.in.host | 31 ++++++++++++++++++++++++
package/cmake/cmake.mk | 1 +
package/libjxl/Config.in | 1 +
support/dependencies/check-host-cmake.mk | 12 +++++----
4 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/package/cmake/Config.in.host b/package/cmake/Config.in.host
index b2e210ee2c..fe5640088e 100644
--- a/package/cmake/Config.in.host
+++ b/package/cmake/Config.in.host
@@ -9,3 +9,34 @@ config BR2_PACKAGE_HOST_CMAKE
the compiler environment of your choice.
http://www.cmake.org/
+
+# The latest version in this list must match the one provided by host-cmake.
+config BR2_HOST_CMAKE_AT_LEAST_3_18 # Debian bullseye provide cmake 3.18.x
+ bool
+ default y
+
+config BR2_HOST_CMAKE_AT_LEAST_3_19
+ bool
+ select BR2_HOST_CMAKE_AT_LEAST_3_18
+
+config BR2_HOST_CMAKE_AT_LEAST_3_20
+ bool
+ select BR2_HOST_CMAKE_AT_LEAST_3_19
+
+config BR2_HOST_CMAKE_AT_LEAST_3_21
+ bool
+ select BR2_HOST_CMAKE_AT_LEAST_3_20
+
+config BR2_HOST_CMAKE_AT_LEAST_3_22
+ bool
+ select BR2_HOST_CMAKE_AT_LEAST_3_21
+
+# This order guarantees that the highest version is set, as kconfig
+# stops affecting a value on the first matching default.
+config BR2_HOST_CMAKE_AT_LEAST
+ string
+ default "3.22" if BR2_HOST_CMAKE_AT_LEAST_3_22
+ default "3.21" if BR2_HOST_CMAKE_AT_LEAST_3_21
+ default "3.20" if BR2_HOST_CMAKE_AT_LEAST_3_20
+ default "3.19" if BR2_HOST_CMAKE_AT_LEAST_3_19
+ default "3.18" if BR2_HOST_CMAKE_AT_LEAST_3_18
diff --git a/package/cmake/cmake.mk b/package/cmake/cmake.mk
index dc92c8bb4e..b99877696a 100644
--- a/package/cmake/cmake.mk
+++ b/package/cmake/cmake.mk
@@ -4,6 +4,7 @@
#
################################################################################
+# When updating the version, please also update BR2_HOST_CMAKE_AT_LEAST_X_Y
CMAKE_VERSION_MAJOR = 3.22
CMAKE_VERSION = $(CMAKE_VERSION_MAJOR).3
CMAKE_SITE = https://cmake.org/files/v$(CMAKE_VERSION_MAJOR)
diff --git a/package/libjxl/Config.in b/package/libjxl/Config.in
index da04b89f9b..923560298f 100644
--- a/package/libjxl/Config.in
+++ b/package/libjxl/Config.in
@@ -7,6 +7,7 @@ config BR2_PACKAGE_LIBJXL
# libjxl fail to link statically due to libatomic issue
depends on !BR2_STATIC_LIBS
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_81426
+ select BR2_HOST_CMAKE_AT_LEAST_3_19
select BR2_PACKAGE_BROTLI
select BR2_PACKAGE_HIGHWAY
select BR2_PACKAGE_LCMS2
diff --git a/support/dependencies/check-host-cmake.mk b/support/dependencies/check-host-cmake.mk
index 5760e4ded1..e367690319 100644
--- a/support/dependencies/check-host-cmake.mk
+++ b/support/dependencies/check-host-cmake.mk
@@ -1,9 +1,11 @@
-# Set this to either 3.18 or higher, depending on the highest minimum
-# version required by any of the packages bundled in Buildroot. If a
-# package is bumped or a new one added, and it requires a higher
-# version, our cmake infra will catch it and build its own.
+# The cmake minimum version is set to either 3.18 or higher,
+# depending on the highest minimum version required by any
+# of the packages bundled in Buildroot. If a package is
+# bumped or a new one added, and it requires a higher
+# cmake version than the one provided by the host, our
+# cmake infra will catch it and build its own.
#
-BR2_CMAKE_VERSION_MIN = 3.18
+BR2_CMAKE_VERSION_MIN = $(BR2_HOST_CMAKE_AT_LEAST)
BR2_CMAKE_CANDIDATES ?= cmake cmake3
BR2_CMAKE ?= $(call suitable-host-package,cmake,\
--
2.34.3
More information about the buildroot
mailing list