Override config-tool get_variable args for qmake

This commit is contained in:
Nirbheek Chauhan 2023-08-31 14:13:50 +05:30 committed by Nirbheek Chauhan
parent 204fe3c577
commit 6cfd2b4d5b
3 changed files with 10 additions and 1 deletions

View File

@ -150,8 +150,11 @@ class ConfigToolDependency(ExternalDependency):
return []
return split_args(out)
def get_variable_args(self, variable_name: str) -> T.List[str]:
return [f'--{variable_name}']
def get_configtool_variable(self, variable_name: str) -> str:
p, out, _ = Popen_safe(self.config + [f'--{variable_name}'])
p, out, _ = Popen_safe(self.config + self.get_variable_args(variable_name))
if p.returncode != 0:
if self.required:
raise DependencyException(

View File

@ -350,6 +350,9 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta):
return m.group(0).rstrip('.')
return version
def get_variable_args(self, variable_name: str) -> T.List[str]:
return ['-query', f'{variable_name}']
@abc.abstractmethod
def get_private_includes(self, mod_inc_dir: str, module: str) -> T.List[str]:
pass

View File

@ -50,6 +50,9 @@ foreach qt : ['qt4', 'qt5', 'qt6']
qtmodule = import(qt)
assert(qtmodule.has_tools())
# Test that fetching a variable works and yields a non-empty value
assert(qtdep.get_variable('prefix', configtool: 'QT_INSTALL_PREFIX') != '')
# The following has two resource files because having two in one target
# requires you to do it properly or you get linker symbol clashes.