facebook / mvfst

An implementation of the QUIC transport protocol.
MIT License
1.5k stars 244 forks source link

How to use mvfst in my project #312

Closed HaseebLUMS closed 1 year ago

HaseebLUMS commented 1 year ago

Hi,

A newbie question. I have built mvfst using the recommended method of running getdeps.sh. Now I see that all the binaries are in _build/mvfst/lib. How do I compile my own project that uses the mvfst as a library? Is there any example cmake file that I can use?

HaseebLUMS commented 1 year ago

While using cmake to use mvfst in my project, I get the following error during making:

ld: library not found for -lgflags_shared clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am not able to work around it.

Following is my CMakeLists.txt

cmake_minimum_required(VERSION 3.15) project(testing) set(CMAKE_CXX_STANDARD 17) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) find_package(mvfst REQUIRED) add_executable(${PROJECT_NAME} hello.cpp) target_link_libraries(${PROJECT_NAME} mvfst::mvfst_client)

HaseebLUMS commented 1 year ago

turns out i just had to include some find_package commands in my CMakeLists.txt

Here are all of my find_package commands in case some newbie like me would wanna know:

find_package(fizz CONFIG REQUIRED) find_package(folly CONFIG REQUIRED) find_package(gflags CONFIG REQUIRED) find_package(gtest CONFIG REQUIRED) find_package(mvfst REQUIRED)