diff options
-rw-r--r-- | mesonbuild/dependencies/base.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 6 | ||||
-rw-r--r-- | test cases/unit/46 native file binary/meson.build | 4 | ||||
-rw-r--r-- | test cases/unit/46 native file binary/meson_options.txt | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index a7e2980..3b4edc2 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -399,6 +399,8 @@ class ConfigToolDependency(ExternalDependency): 'Falling back to searching PATH. This may find a ' 'native version of {0}!'.format(self.tool_name)) tools = self.tools + elif self.tool_name in self.env.config_info.binaries: + tools = [self.env.config_info.binaries[self.tool_name]] else: tools = self.tools diff --git a/run_unittests.py b/run_unittests.py index b375629..cd1bf62 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4548,6 +4548,12 @@ class NativeFileTests(BasePlatformTests): def test_find_program(self): self._simple_test('find_program', 'bash') + def test_config_tool_dep(self): + # Do the skip at this level to avoid screwing up the cache + if not shutil.which('llvm-config'): + raise unittest.SkipTest('No llvm-installed, cannot test') + self._simple_test('config_dep', 'llvm-config') + def unset_envs(): # For unit tests we must fully control all command lines diff --git a/test cases/unit/46 native file binary/meson.build b/test cases/unit/46 native file binary/meson.build index 3c99929..3754dfa 100644 --- a/test cases/unit/46 native file binary/meson.build +++ b/test cases/unit/46 native file binary/meson.build @@ -6,4 +6,8 @@ if case == 'find_program' prog = find_program('bash') result = run_command(prog, ['--version']) assert(result.stdout().strip().endswith('12345'), 'Didn\'t load bash from config file') +elif case == 'config_dep' + add_languages('cpp') + dep = dependency('llvm') + assert(dep.get_configtool_variable('version').endswith('12345'), 'Didn\'t load llvm from config file') endif diff --git a/test cases/unit/46 native file binary/meson_options.txt b/test cases/unit/46 native file binary/meson_options.txt index 83d34e8..5663ab3 100644 --- a/test cases/unit/46 native file binary/meson_options.txt +++ b/test cases/unit/46 native file binary/meson_options.txt @@ -1,5 +1,5 @@ option( 'case', type : 'combo', - choices : ['find_program'] + choices : ['find_program', 'config_dep'] ) |