MSVC: Finding libraries named ${name}.dll.lib generated by rustc/cargo/cargo-c
The Windows platform has three types of libraries: static, dynamic, and import. Unfortunately, the suffix for static and import libraries is the same (.lib
). Various unofficial approaches are used to resolve this ambiguity by changing the names of either static or import libraries to indicate which one they are. For an example library named foo
, MESON uses the libfoo.a
for static libraries or libfoo.dll.a
for import libraries depending on the compiler toolchain, some projects name their static libraries foo_static.lib
, and in the case of the Rust toolchain, they have chosen to name the import library foo.dll.lib
or foo.dll.a
depending on the host compiler.
I'd like to add support for these .dll.lib
suffixes for import libraries, so that finding libraries built with cargo-c / the rust toolchain has less friction.
I believe this would involve adding .dll.lib
to the default list of CMAKE_FIND_LIBRARY_SUFFIXES
when WIN32 AND NOT MINGW
, but I'm not exactly sure in which file I should add it. I'd be happy to open a PR if y'all are interested in this improvement and can point me to the correct file.
https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa https://github.com/rust-lang/cargo/blob/a5fa676731c8e570bb9be9c50d2202acea84b6b6/src/cargo/core/compiler/build_context/target_info.rs#L389