diff options
author | Lars Persson <larper@axis.com> | 2017-05-14 15:33:55 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-05-14 19:01:14 +0300 |
commit | a3856be1d50eaefe32fee5d3347d55d934d15b50 (patch) | |
tree | f378774e605c01a980e2b7910532b1c36a566600 | |
parent | a1a4f66e6d915c1f6aae2ead02cf5631b10c76f1 (diff) | |
download | meson-a3856be1d50eaefe32fee5d3347d55d934d15b50.zip meson-a3856be1d50eaefe32fee5d3347d55d934d15b50.tar.gz meson-a3856be1d50eaefe32fee5d3347d55d934d15b50.tar.bz2 |
gmockdependency: find libraries using the compiler
Use the compiler object to find the gmock library. Fixes following
cases:
- cross compiling looked in host library paths
- static libgmock was not supported
Change-Id: Ie3912b8b4dd3b71d7a5ae2adae7295d3b685fddf
-rw-r--r-- | mesonbuild/dependencies/dev.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 470ad1e..10f7ad3 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -105,16 +105,14 @@ class GMockDependency(Dependency): # GMock may be a library or just source. # Work with both. self.name = 'gmock' - self.libname = 'libgmock.so' - trial_dirs = mesonlib.get_library_dirs() - gmock_found = False - for d in trial_dirs: - if os.path.isfile(os.path.join(d, self.libname)): - gmock_found = True - if gmock_found: + cpp_compiler = dependency_get_compiler('cpp', environment, kwargs) + if cpp_compiler is None: + raise DependencyException('Tried to use gmock but a C++ compiler is not defined.') + gmock_detect = cpp_compiler.find_library("gmock", environment, []) + if gmock_detect: self.is_found = True self.compile_args = [] - self.link_args = ['-lgmock'] + self.link_args = gmock_detect self.sources = [] mlog.log('Dependency GMock found:', mlog.green('YES'), '(prebuilt)') return |