简体   繁体   中英

Linking Facebook Proxygen with 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()

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

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM