Saturday, October 30, 2021

[SOLVED] How to use Facebook Wangle in Windows with vcpkg

Issue

When I install Wangle with vcpkg install wangle I see the below message:

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)

But when I write my own CMakeLists.txt and write find_package(wangle CONFIG REQUIRED) . and run with

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

I see the below error:

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!

Solution

As you can see in [wangle] find_package(wangle) failed issue on vcpkg, this problem is for bug on port, and after this bug was resolved, the above error (WANGLE_CMAKE_DIR does not exist) was resolved, and the library worked properly.

So as you can see in the install message below, the command is working correctly for using Wangle in Windows with vcpkg in all CMake base projects.

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


Answered By - sorosh_sabz