summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2023-10-21 02:05:52 +0200
committerArmin Kuster <akuster808@gmail.com>2023-10-30 07:14:02 -0400
commit840df5af41967d558e3d50d06490797c5fee6176 (patch)
tree423f6d4261690923fb433d3b760a6c1ee66cd7e5
parent07f42432ca1fc53ae60b89f10122d16a1142272a (diff)
downloadmeta-openembedded-840df5af41967d558e3d50d06490797c5fee6176.tar.gz
leveldb: prevent installing gtest
* Causes conflicts when leveldb is used in component which itself also depends on gtest e.g. leveldb-tl in meta-webosose: ERROR: lib32-leveldb-tl-0.1.6-r4 do_prepare_recipe_sysroot: The file /usr/lib/pkgconfig/gtest.pc is installed by both lib32-googletest and lib32-leveldb, aborting Signed-off-by: Martin Jansa <martin.jansa@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> (cherry picked from commit 6ffae4286a6fa4a1af475333cb4c9005bae53be0) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-dbs/leveldb/leveldb/0001-CMakeLists.txt-fix-googletest-related-options.patch55
-rw-r--r--meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb4
2 files changed, 58 insertions, 1 deletions
diff --git a/meta-oe/recipes-dbs/leveldb/leveldb/0001-CMakeLists.txt-fix-googletest-related-options.patch b/meta-oe/recipes-dbs/leveldb/leveldb/0001-CMakeLists.txt-fix-googletest-related-options.patch
new file mode 100644
index 0000000000..b0bfb8bf16
--- /dev/null
+++ b/meta-oe/recipes-dbs/leveldb/leveldb/0001-CMakeLists.txt-fix-googletest-related-options.patch
@@ -0,0 +1,55 @@
1From 77da477840f89da7ced29da315de77571e8f190e Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Fri, 20 Oct 2023 22:57:48 +0200
4Subject: [PATCH] CMakeLists.txt: fix googletest related options
5
6* https://cmake.org/cmake/help/book/mastering-cmake/chapter/Writing%20CMakeLists%20Files.html
7 says that CMake options are case-sensitive and I don't see lower-case version in
8 currently used googletest submodules and gtest is indeed installed with leveldb
9
10* install_gmock option I don't see at all, so I've kept it as is, INSTALL_GTEST, BUILD_GMOCK
11 do exist as upper-case
12
13$ grep -Ri install_.*mock .
14./CMakeLists.txt: set(install_gmock OFF)
15./third_party/googletest/googlemock/CMakeLists.txt:install_project(gmock gmock_main)
16$ grep -Ri build_gmock .
17./CMakeLists.txt: set(BUILD_GMOCK ON)
18./third_party/googletest/googletest/README.md:cmake .. -DBUILD_GMOCK=OFF
19./third_party/googletest/CMakeLists.txt:option(BUILD_GMOCK "Builds the googlemock subproject" ON)
20./third_party/googletest/CMakeLists.txt:if(BUILD_GMOCK)
21$ grep -Ri install_gtest .
22./CMakeLists.txt: set(INSTALL_GTEST OFF)
23./third_party/googletest/googletest/cmake/internal_utils.cmake: if(INSTALL_GTEST)
24./third_party/googletest/googletest/CMakeLists.txt:if (INSTALL_GTEST)
25./third_party/googletest/CMakeLists.txt:option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
26
27* also use CACHE and FORCE as sugested in:
28 https://cmake.org/cmake/help/latest/command/set.html
29 https://stackoverflow.com/questions/20239334/cmake-set-subdirectory-options
30 for the value to correctly propagate into third_party/googletest subdirectory
31
32Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
33---
34Upstream-Status: Submitted [https://github.com/google/leveldb/pull/1152]
35
36 CMakeLists.txt | 6 +++---
37 1 file changed, 3 insertions(+), 3 deletions(-)
38
39diff --git a/CMakeLists.txt b/CMakeLists.txt
40index fda9e01..f8a2629 100644
41--- a/CMakeLists.txt
42+++ b/CMakeLists.txt
43@@ -295,9 +295,9 @@ if(LEVELDB_BUILD_TESTS)
44
45 # Prevent overriding the parent project's compiler/linker settings on Windows.
46 set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
47- set(install_gtest OFF)
48- set(install_gmock OFF)
49- set(build_gmock ON)
50+ set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
51+ set(install_gmock OFF CACHE BOOL "" FORCE)
52+ set(BUILD_GMOCK ON CACHE BOOL "" FORCE)
53
54 # This project is tested using GoogleTest.
55 add_subdirectory("third_party/googletest")
diff --git a/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb b/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
index 61fa02c154..ab0176ff9b 100644
--- a/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
+++ b/meta-oe/recipes-dbs/leveldb/leveldb_1.23.bb
@@ -5,7 +5,9 @@ LICENSE = "BSD-3-Clause"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=92d1b128950b11ba8495b64938fc164d" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=92d1b128950b11ba8495b64938fc164d"
6 6
7SRC_URI = "gitsm://github.com/google/${BPN}.git;branch=main;protocol=https \ 7SRC_URI = "gitsm://github.com/google/${BPN}.git;branch=main;protocol=https \
8 file://run-ptest" 8 file://0001-CMakeLists.txt-fix-googletest-related-options.patch \
9 file://run-ptest \
10"
9 11
10SRCREV = "068d5ee1a3ac40dabd00d211d5013af44be55bea" 12SRCREV = "068d5ee1a3ac40dabd00d211d5013af44be55bea"
11S = "${WORKDIR}/git" 13S = "${WORKDIR}/git"