Skip to content

CMake Code Snippets ​

  • Show all options
bash
cmake -LA

用 PROTOBUF_LIBRARIES(複數),不是 PROTOBUF_LIBRARY:後者不含 pthread 等依賴,會在 runtime 噴 libprotobuf FATAL ... SCCInfoBase::kRunning。

cmake
find_package(Protobuf 3.14.0 REQUIRED)
target_link_libraries(main proto ${PROTOBUF_LIBRARIES})
# 或用 imported target:protobuf::libprotobuf

原文:Protobuf 3.14.0 和 CMake 的一些小細節

頁面歷史

Just observe 👀