wwbmmm commented on issue #3528:
URL: https://github.com/apache/brpc/issues/3528#issuecomment-5559422121
您好,感谢反馈。brpc 目前的 CMake 是通过标准的 `find_package` / `find_library` 机制来解析依赖的,例如
`CMakeLists.txt:229` 的 `find_package(Protobuf REQUIRED)`、第 343/349 行使用
`${PROTOBUF_INCLUDE_DIRS}` / `${PROTOBUF_LIBRARIES}`,以及
`cmake/CompileProto.cmake` 中的 `${PROTOBUF_PROTOC_EXECUTABLE}`。这些正是 Conan 的
`CMakeDeps` 生成器通常会提供的变量,所以理论上通过 `add_subdirectory` 引入 brpc 时是**可以直接用 Conan 提供
protobuf 的**,前提是让 brpc 这个子项目能找到 Conan 生成的 config 文件(即通过你的工程传给 brpc 的
`CMAKE_PREFIX_PATH`,或 `CMakeToolchain` 生成的 toolchain file)。
目前您提到“依赖库会出错,尤其是 protobuf”,但没有给出具体报错,很难判断是 brpc 的 CMake 需要改动、还是当前工程的 Conan
配置问题。麻烦补充以下信息:
1. 完整的报错输出(是 cmake 阶段还是编译阶段?贴出关键几行即可);
2. Conan 是 1.x 还是 2.x?用的是哪个生成器(`CMakeDeps`/`CMakeToolchain`,还是旧版
`cmake`/`txt` 生成器)?conan profile 是什么(操作系统/编译器/构建类型)?
3. protobuf 的版本、brpc 的版本(当前 release 还是 master);
4. 你在自己的工程里是如何 `add_subdirectory` 引入 brpc 的,以及 brpc
的依赖(gflags、leveldb、zlib、openssl 等)是否是全部通过 Conan 安装的。
拿到这些信息后,我能帮你判断是只需要调整本地的 Conan/CMake 配置(多数情况是这样,比如确保 brpc 子目录能拿到 Conan
toolchain 提供的 `CMAKE_PREFIX_PATH`),还是确实需要 brpc 的 `CMakeLists.txt` 做兼容性改动。
---
🤖 This reply was automatically generated by brpc-oncall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]