16
Tôi đang cố gắng để làm cho nó cùng một cách mà tôi đã làm cho nó cho tăng:Làm thế nào để liên kết các thư viện protobuf google thông qua cmake trên linux?
find_package(Boost COMPONENTS system filesystem REQUIRED)
find_package(ProtocolBuffers)
## Compiler flags
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_EXE_LINKER_FLAGS "-lsqlite3 -lrt -lpthread")
endif()
target_link_libraries(complex
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${PROTOBUF_LIBRARY}
)
(googled nó ở đâu đó) nhưng có đầu ra xấu:
CMake Warning at complex/CMakeLists.txt:18 (find_package):
Could not find module FindProtocolBuffers.cmake or a configuration file for
package ProtocolBuffers.
Adjust CMAKE_MODULE_PATH to find FindProtocolBuffers.cmake or set
ProtocolBuffers_DIR to the directory containing a CMake configuration file
for ProtocolBuffers. The file will have one of the following names:
ProtocolBuffersConfig.cmake
protocolbuffers-config.cmake
Làm thế nào tôi có thể liên kết nó với cmake? hoặc có lẽ tôi thậm chí có thể biên dịch .proto tập tin bằng cách sử dụng cmake?
Cảm ơn bạn đã trả lời này. Thay vì '$ {Boost_FILESYSTEM_LIBRARY}' và '$ {Boost_SYSTEM_LIBRARY}' bạn có thể sử dụng '$ {Boost_LIBRARIES}'. –