From an administrator CMD prompt, I installed Protobuf on my Windows machine the following way:
git clone -b v28.3 --recurse-submodules .git
cd protobuf
mkdir build
cd build
cmake ..
cmake --build . --target install
The build uses Visual Studio Community 2022 and CMake 3.30, which I have also installed and are in my PATH. (BTW, The reason why I am not using the latest (v30) version of protobuf is that the build complains about my compiler not being C++ 17 compliant).
Once the above completes, everything is installed under C:\Program Files (x86)\protobuf
.
In the CMakeLists.txt of my project, I have the following code:
cmake_minimum_required(VERSION 3.16)
project(myproject)
find_package(Protobuf REQUIRED HINTS "C:/Program Files (x86)/protobuf")
add_executable(myexe, main.cpp)
The error I am getting is:
The following import targets are referenced, but are missing:
absl::..... absl::...... (lots)
I believed that Abseil was shipped directly inside protobuf, so I am surprised this error is raised.
I decided to go ahead and build/install Abseil as well using CMake and its own repo. Abseil is successfully installed into C:\Program Files (x86)\absl
once the installation process is complete. When I try to run CMake again on my project, I get an error with just 3 import targets:
The following import targets are referenced, but are missing:
absl::if_constexpr utf8_range::utf8_validity utf8_range::utf8_range
Here again, I am surprise utf8_range does not get automatically built, since it is part of protobuf.
Is there something I am doing wrong when building protobuf, I mean shouldn't I be able to build all its dependencies as well?