Hello
I have the same problem.
What I've noticed on my machine is that there is a difference between 
*find_package(Protobuf 
CONFIG REQUIRED)* and *find_package(protobuf CONFIG REQUIRED)*. Protobuf that 
starts with small letters contains protobuf::gmock target, however it is  
defined in following way:

*# Create imported target protobuf::gmockadd_library(protobuf::gmock STATIC 
IMPORTED)*
So it's only gmock target in protobuf namespace. 

Still, I get the same error and it doesn't work. I'm don't know how to 
install gmock to make it work.

BR,
Piecuch Z.

sobota, 6 kwietnia 2024 o 23:30:22 UTC+2 Evan Wegley napisaƂ(a):

Protobuf version: v26.1
CMake version: 3.29.0

I built protobuf in a container as follows:

(From the local machine running Docker Desktop)
$ docker pull ubuntu:jammy
$ docker run -it -v /opt/ext:/opt/ext ubuntu:jammy

(From inside the container)
$ apt-get update
$ apt-get install build-essential git cmake
$ cd
$ git clone -b v26.1 https://github.com/protocolbuffers/protobuf.git
$ cd protobuf/
$ git submodule update --init --recursive
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/ext/protobuf .
$ make -j 4 install

Now I have protobuf installed to /opt/ext/protobuf in my local Linux 
environment (Also Ubuntu 22.04).

In my local environment, I set up a CMake project with the following 
minimal CMakeLists.txt.

cmake_minimum_required(VERSION 3.29)
project(Demo VERSION 1.0)
list(APPEND CMAKE_PREFIX_PATH "/opt/ext/protobuf")
find_package(Protobuf PATHS "/opt/ext/protobuf" CONFIG REQUIRED)

But when I try to build, I get this warning:

CMake Warning at 
/opt/ext/protobuf/lib/cmake/protobuf/protobuf-config.cmake:7 (find_package):
  Found package configuration file:

    /opt/ext/protobuf/lib/cmake/absl/abslConfig.cmake

  but it set absl_FOUND to FALSE so package "absl" is considered to be NOT
  FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  protobuf::gmock

Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)


Is this a bug, or is there something wrong with my usage?

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/48f85b9b-ba59-46bf-a67b-84549d8e00e3n%40googlegroups.com.

Reply via email to