mesonbuild/meson

Inconsistency between library suffix generated on windows and link name created when using dependency()

Open

#1,907 opened on Jun 6, 2017

 (3 comments) (0 reactions) (0 assignees)Python (1,465 forks)batch import
OS:windowsbugdependencieshelp wanted

Repository metrics

Stars
 (4,978 stars)
PR merge metrics
 (Avg merge 139d 13h) (51 merged PRs in 30d)

Description

Meson wants to create libraries with the style liblibname.a even on Windows. I can deal with that.

Note the following in the meson build.py source:

    # By default a static library is named libfoo.a even on Windows because
    # MSVC does not have a consistent convention for what static libraries
    # are called. The MSVC CRT uses libfoo.lib syntax but nothing else uses
    # it and GCC only looks for static libraries called foo.lib and
    # libfoo.a. However, we cannot use foo.lib because that's the same as
    # the import library. Using libfoo.a is ok because people using MSVC
    # always pass the library filename while linking anyway.

However, when using a pkg-config dependency setup for the library, meson will try to link with libname.lib, not the liblibname.a that was created.

Summary: In project A: meson creates libs with liblibname.a format in C:/lib/ folder (when installed) a .pc file is created using the pkg.generate() command (although I have to manually change \ to /)

in Project B: I want to link with the library from project A. meson finds the .pc file ok however, generates link command -llibname.lib

These behaviours are inconsistent

Contributor guide