How to integrate Vcpkg with Meson Build system (Modern way)

· Francesco · 1 min read · 140 words

Photo by Steve A Johnson from Pexels

Well, I already published a way to make Meson work with vcpkg and today I have a newer way to do the same.

I was writing a simple SFTP client and I needed the libssh library. Here is the modern way to set it up:

Prerequisites

  • Install vcpkg as usual
  • Install Visual Studio, Desktop C++ to make it works

Step-by-Step Guide

  1. Install dependencies:

    1
    
    $ vcpkg install libssh pkgconf
    

    Note: Remember to install pkgconf; Meson needs it to find where the libraries are.

  2. Configure your PATH: Add the vcpkg/installed/x64-windows/tools/pkgconf folder to your $PATH, and rename pkgconf.exe to pkg-config.exe.

  3. Set up Environment Variables: Create a new environment variable named PKG_CONFIG_PATH and point it to vcpkg/installed/x64-windows/lib/pkgconfig.

  4. Run your app: Finally, add the DLL path (lib/) to your PATH so you can run your built app.