1

Let me assume that I wanna use curl package in msys2 for my C++ project. enter image description here

So I add msys2 path to %Path% in system environment. enter image description here

and I write my meson.build file like below:

project('tutorial', 'cpp')
my_dependency = dependency('curl')
executable('demo', 'main.cpp', dependencies : my_dependency)

... and setup the meson with meson setup builddir but it fails with following error:

The Meson build system
Version: 0.62.0
Source dir: C:\Users\woose\example
Build dir: C:\Users\woose\example\builddir
Build type: native build
Project name: tutorial
Project version: undefined
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (Rev10, Built by MSYS2 project) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: C:\msys64\mingw64\bin\pkg-config.EXE (1.8.0)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency curl found: NO (tried pkgconfig)

meson.build:2:0: ERROR: Dependency "curl" not found, tried pkgconfig

A full log can be found at C:\Users\woose\example\builddir\meson-logs\meson-log.txt

How can I fix it?

WOOSEOK CHOI
  • 165
  • 9
  • `curl` installs to `C:\msys64\usr\bin` I think? `mingw-w64-x86_64-curl` would install to `C:\msys64\mingw64\bin`. Since you're already using the compiler at `/mingw64/bin`, you want the latter package. – HolyBlackCat Mar 30 '22 at 06:41
  • I'm noob of meson so I didn't concerned of compiler. I could find the way and fixed it. Thx. – WOOSEOK CHOI Apr 01 '22 at 02:50

1 Answers1

1

I fixed it. plus, added include directories.

project('tutorial', 'cpp')
cpp = meson.get_compiler('cpp')
my_dependency = cpp.find_library('curl', dirs: 'C:/msys64/mingw64')
cflags = include_directories('c:/msys64/mingw64/include/curl')
executable('demo', 'main.cpp', include_directories : cflags, dependencies : my_dependency)
WOOSEOK CHOI
  • 165
  • 9
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 01 '22 at 04:23