semlanik / qtprotobuf

Protobuf generator and bindings for Qt framework
https://semlanik.github.io/qtprotobuf
MIT License
167 stars 38 forks source link

Difficulty with FindWrapProtobuf.cmake #232

Open gmabey opened 3 years ago

gmabey commented 3 years ago

I'm attempting to build my application (and QtProtobuf) for CentOS 8.3 -- there's other platforms I've tried that have ended up with this same error, but I'm just focusing on CentOS 8.3 right now.

I had to install cmake 3.20.3 (just the binary tarball) and I compiled Qt 5.12.11 from source.

I got QtProtobuf to compile, but when I run cmake for my application, I get the following error:

-- The CXX compiler identification is GNU 8.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/local/cmake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find WrapProtobuf (missing: Protobuf_INCLUDE_DIRS Protobuf)
Call Stack (most recent call first):
  /usr/local/cmake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/lib64/cmake/QtProtobuf/FindWrapProtobuf.cmake:103 (find_package_handle_standard_args)
  /usr/local/cmake/share/cmake-3.20/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/lib64/cmake/QtProtobuf/QtProtobufProtobufWellKnownTypesConfig.cmake:5 (find_dependency)
  /usr/lib64/cmake/QtProtobuf/QtProtobufConfig.cmake:20 (include)
  CMakeLists.txt:172 (find_package)

-- Configuring incomplete, errors occurred!

I've looked at /usr/lib64/cmake/QtProtobuf/FindWrapProtobuf.cmake but can't make any sense out of it.

To build QtProtobuf I've tried using OS-provided versions of protobuf as well as the submodule 3rdparty with identical results. I just don't understand what's going on in FindWrapProtobuf ...

My questions are:

  1. Do you think that QtProtobuf's .cmake files getting installed into /usr/lib/64/cmake/ is a problem?
  2. Is this possibly an issue arising from the version of cmake I'm using?
  3. What is the most recent version of cmake that has been used to build QtProtobuf?
semlanik commented 3 years ago

Ok the error you observe causes that Protobuf_INCLUDE_DIRS variable is not set when QtProtobufWellKnownTypes is trying to resolve its dependencies. There might be multiple possible reasons for this behavior. Could you please check if /usr/include/google/protobuf/message.h is present in your system?

I have feeling that you need to set the correct CMAKE_INCLUDE_PATH cache variable. Perhaps something like: -DCMAKE_INCLUDE_PATH=/usr/include/64