dependencies: Allow config tool dependencies to use native files
This allows tools like llvm-config to be selected from the config file Fixes: #3327
This commit is contained in:
parent
42ddc30cfe
commit
caf1066cd1
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
option(
|
||||
'case',
|
||||
type : 'combo',
|
||||
choices : ['find_program']
|
||||
choices : ['find_program', 'config_dep']
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue