meson icon indicating copy to clipboard operation
meson copied to clipboard

cmake dependency: confusing formulation of warning

Open anarazel opened this issue 7 months ago • 2 comments

Hi,

When a dependency is found via cmake and the "target module" can't be identified unambiguously, a confusing error message is printed. E.g. when looking for zstd via cmake:

zstd = dependency('zstd', method: 'cmake')

the following message is printed:

WARNING: Could not find and exact match for the CMake dependency zstd.

However, Meson found the following partial matches:

    ['zstd::libzstd_shared', 'zstd::libzstd_static', 'zstd::libzstd']

Using imported is recommended, since this approach is less error prone
and better supported by Meson. Consider explicitly specifying one of
these in the dependency call with:

    dependency('zstd', modules: ['zstd::<name>', ...])

Meson will now continue to use the old-style zstd_LIBRARIES CMake
variables to extract the dependency information since no explicit
target is currently specified.


Run-time dependency zstd found: NO 

../meson.build:18:8: ERROR: Dependency lookup for zstd with method 'cmake' failed: Dependency zstd not found: CMake: failed to guess a CMake target for zstd.
Try to explicitly specify one or more targets with the "modules" property.
Valid targets are:
['Threads::Threads', 'zstd::libzstd_shared', 'zstd::libzstd_static', 'zstd::libzstd']

There's a few issues here

  • s/and exact/an exact/ - that's easy enough
  • "Using imported is recommended" - I don't know what exactly this is trying to say, so I can't fix it.
  • it's also confusing that the message talks about 'zstd::<name>', even though that's not one of the options in this case, but that's may be more work to fix than it's worth

CC: @mensinda - looks like this is from f1614a6071

Greetings,

Andres

anarazel avatar Jul 09 '24 05:07 anarazel