From a3856be1d50eaefe32fee5d3347d55d934d15b50 Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Sun, 14 May 2017 15:33:55 +0200 Subject: 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 --- mesonbuild/dependencies/dev.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'mesonbuild/dependencies/dev.py') 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 -- cgit v1.1