如何通过 vcpkg 在 Windows 中使用 Facebook Wangle

How to use Facebook Wangle in Windows with vcpkg

当我用 vcpkg install wangle 安装 Wangle 时,我看到以下消息:

The following packages are already installed:
    wangle[core]:x64-windows
Starting package 1/1: wangle:x64-windows
Package wangle:x64-windows is already installed
Elapsed time for package wangle:x64-windows: 3.573 ms

Total elapsed time: 4.733 ms

The package wangle:x64-windows provides CMake targets:

    find_package(wangle CONFIG REQUIRED)
    target_link_libraries(main PRIVATE wangle::wangle)

但是当我自己写 CMakeLists.txt 并写 find_package(wangle CONFIG REQUIRED) 时。 运行 和

cmake .. -DCMAKE_TOOLCHAIN_FILE='C:\Users\sooro\Documents\vcpkg\vcpkg\scripts\buildsystems\vcpkg.cmake'

我看到以下错误:

CMake Error at C:/Users/sooro/Documents/vcpkg/vcpkg/installed/x64-windows/share/wangle/wangle-config.cmake:22 (message):
  File or directory
  C:/Users/sooro/Documents/vcpkg/vcpkg/installed/x64-windows/lib/cmake/wangle
  referenced by variable WANGLE_CMAKE_DIR does not exist !
Call Stack (most recent call first):
  C:/Users/sooro/Documents/vcpkg/vcpkg/installed/x64-windows/share/wangle/wangle-config.cmake:39 (set_and_check)
  C:/Users/sooro/Documents/vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake:258 (_find_package)
  CMakeLists.txt:35 (find_package)


-- Configuring incomplete, errors occurred!

[wangle] find_package(wangle) failed issue on vcpkg中可以看到,这个问题是port上的bug,解决这个bug后,上面的错误(WANGLE_CMAKE_DIR does not exist ) 已解决,库正常工作。

因此,正如您在下面的安装消息中看到的那样,该命令在 Windows 中使用 Wangle 并在所有 CMake 个基础项目中使用 vcpkg 正常工作。

find_package(wangle CONFIG REQUIRED)
target_link_libraries(main PRIVATE wangle::wangle)