diff mbox series

[meta-oe] leveldb: Allow to build with CMake 4+

Message ID 20250715071810.601463-1-Moritz.Haase@bmw.de
State Under Review
Headers show
Series [meta-oe] leveldb: Allow to build with CMake 4+ | expand

Commit Message

Haase Moritz, JD-62 July 15, 2025, 7:18 a.m. UTC
The component itself builds just fine with CMake 4, but the tests don't as they
rely on a bundled version of GTest that is six years old. Since upstream is
inactive, the simplest course of action is to apply the 'minimum policy version'
override (as implemented in CMake, it only affects the GTest submodule).

System GTest can not be used instead (easily), as among other things it requires
C++14 and the project uses C++11.

Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
CC: Khem Raj <raj.khem@gmail.com>
---
 meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb b/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
index 9cefc528ae..1ccf115793 100644
--- a/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
+++ b/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
@@ -18,8 +18,12 @@  PACKAGECONFIG[benchmarks] = "-DLEVELDB_BUILD_BENCHMARKS=ON,-DLEVELDB_BUILD_BENCH
 PACKAGECONFIG[snappy] = ",,snappy"
 PACKAGECONFIG[tcmalloc] = ",,gperftools"
 
+# CMake policy override is only required for (and only affects) the bundled GTest submodule.
+# System GTest can not be used instead, since (among other things) it requires C++14 and the project uses C++11.
 EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DCMAKE_SKIP_RPATH=ON \
-                 -DLEVELDB_BUILD_TESTS=${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'ON', 'OFF', d)}"
+                 -DLEVELDB_BUILD_TESTS=${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'ON', 'OFF', d)} \
+                 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
+"
 
 do_install:append() {
     install -D -m 0755 ${B}/leveldbutil ${D}${bindir}/leveldbutil