Browse Source

fix(build): make pkg-config verbose about why it fails

Switch from `pkg_search_module` to `pkg_check_modules` to find .pc and
evaluate .pc files of dependencies. Now, in case of any errors, a clear
message is issued about what is wrong, making it obvious what to do.

As of c-toxcore-0.2.11, my system's toxcore.pc file contains this line:
```
Requires.private: libsodium opus vpx
```

Previously, with opus missing, cmake/Dependencies.cmake through an error
about toxcore not being found, but never actually told why (also it was
misleading, because opus was missing, not toxcore).

Before:
```
<...>
-- Checking for one of the modules 'toxcore'
-- TOXCORE not found
-- Checking for one of the modules 'toxav'
-- TOXAV not found
<...>
```

After:
```
<...>
-- Checking for module 'toxcore'
--   Package 'opus', required by 'toxcore', not found
-- TOXCORE not found
-- Checking for module 'toxav'
--   No package 'toxav' found
-- TOXAV not found
<...>
```
reviewable/pr6064/r1
Piraty 5 years ago
parent
commit
e4c7d81ab2
  1. 2
      cmake/Dependencies.cmake

2
cmake/Dependencies.cmake

@ -58,7 +58,7 @@ function(search_dependency pkg)
# Try pkg-config first. # Try pkg-config first.
if(NOT ${pkg}_FOUND AND arg_PACKAGE) if(NOT ${pkg}_FOUND AND arg_PACKAGE)
pkg_search_module(${pkg} ${arg_PACKAGE}) pkg_check_modules(${pkg} ${arg_PACKAGE})
endif() endif()
# Then, try OSX frameworks. # Then, try OSX frameworks.

Loading…
Cancel
Save