【发布时间】:2019-10-23 23:42:39
【问题描述】:
我正在尝试编写一个玩具示例来使用 Facebook 的 Folly library。程序引入如下:
#include <utility>
#include <iostream>
#include <folly/Format.h>
#include <folly/futures/Future.h>
#include <folly/executors/ThreadedExecutor.h>
#include <folly/Uri.h>
#include <folly/FBString.h>
static void print_uri(const folly::fbstring &address)
{
const folly::Uri uri(address);
const auto authority = folly::format("The authority from {} is {}", uri.fbstr(), uri.authority());
std::cout << authority << std::endl;
}
int main()
{
folly::ThreadedExecutor executor;
folly::Promise<folly::fbstring> promise;
folly::Future<folly::fbstring> future = promise.getSemiFuture().via(&executor);
folly::Future<folly::Unit> unit = std::move(future).thenValue(print_uri);
promise.setValue("https://conan.io/");
std::move(unit).get();
return 0;
}
问题是我不确定编译这样的程序需要哪些库。如果有人可以分享CMakeList.txt 文件以用于Folly 项目,我将不胜感激。
【问题讨论】:
-
使用可以使用 vcpkg Microsoft 打包器自动将愚蠢的库安装到您的 vc++ 项目中。
-
你真的试过
find_package(folly REQUIRED)吗?根据this file,他们提供目标Folly::folly和变量FOLLY_INCLUDE_DIRS、FOLLY_LIBRARIES。我没有尝试过,但它似乎很琐碎。 -
非常感谢@Ptaq666。它有帮助,我制作了 CMakeLists。我将在下面发布以帮助其他有类似问题的人。