How to link google protobuf libraries via cmake on linux?

前端 未结 1 1425
清酒与你
清酒与你 2020-12-15 18:57

I\'m trying to make it same way I made it for boost :

find_package(Boost COMPONENTS system filesystem REQUIRED)                                                       


        
相关标签:
1条回答
  • 2020-12-15 19:03

    You could try CMake's FindProtobuf module:

    include(FindProtobuf)
    find_package(Protobuf REQUIRED)
    include_directories(${PROTOBUF_INCLUDE_DIR})
    ...
    target_link_libraries(complex
        ${Boost_FILESYSTEM_LIBRARY}
        ${Boost_SYSTEM_LIBRARY}
        ${PROTOBUF_LIBRARY}
    )
    


    For further info, run

    cmake --help-module FindProtobuf
    
    0 讨论(0)
提交回复
热议问题