将Facebook Proxygen与Cmake链接 [英] Linking Facebook Proxygen with Cmake

查看:79
本文介绍了将Facebook Proxygen与Cmake链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook的wangle库可以使用cmake进行如下设置:

Facebook's wangle library can be set up with cmake like below:

set_and_check(WANGLE_INCLUDE_DIR /usr/local/include/wangle)
set_and_check(WANGLE_CMAKE_DIR /usr/local/lib/cmake/wangle)

if (NOT TARGET wangle::wangle)
    include("${WANGLE_CMAKE_DIR}/wangle-targets.cmake")
endif()

set(WANGLE_LIBRARIES wangle::wangle)

if (NOT wangle_FIND_QUIETLY)
    message(STATUS "Found wangle: ${PACKAGE_PREFIX_DIR}")
endif()

但是,proxygen的install.sh不会像wangle和其他fb库那样将include和lib文件放在/usr/local中.

However, proxygen's install.sh doesn't put the include and lib files in /usr/local like wangle and other fb libraries do.

通过cmake设置包含并与proxygen链接的正确方法是什么?

What is the proper way to set the include and link with proxygen via cmake?

推荐答案

根据proxygen README ,您应该安装所有要求,包括 folly wangle fmt fizz mvfst (如果需要HTTP/3协议).使用 README 中的说明安装proxygen后,可以在CMake项目中使用它.以下是示例 CMakeLists.txt ,您可以在此存储库<中找到完整的示例项目/a>.

According to the proxygen README you should install all requirements, including folly, wangle, fmt, fizz, and mvfst if you need HTTP/3 protocol. After installing proxygen with the instruction in the README you can use it in your CMake project. Following is an example CMakeLists.txt and you can find the complete sample project in this repo.

cmake_minimum_required(VERSION 3.10)

project(3hat)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(proxygen REQUIRED)
find_package(gflags REQUIRED)
  
add_subdirectory(server)

这篇关于将Facebook Proxygen与Cmake链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆