diff options
-rw-r--r-- | mesonbuild/dependencies/qt.py | 2 | ||||
-rw-r--r-- | mesonbuild/programs.py | 21 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/meson.build | 3 |
3 files changed, 15 insertions, 11 deletions
diff --git a/mesonbuild/dependencies/qt.py b/mesonbuild/dependencies/qt.py index 6b8c694..4dd8bf1 100644 --- a/mesonbuild/dependencies/qt.py +++ b/mesonbuild/dependencies/qt.py @@ -252,11 +252,11 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta): """Find Qt using Qmake as a config-tool.""" - tool_name = 'qmake' version_arg = '-v' def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]): _QtBase.__init__(self, name, kwargs) + self.tool_name = f'qmake{self.qtver}' self.tools = [f'qmake{self.qtver}', f'qmake-{self.name}', 'qmake'] # Add additional constraints that the Qt version is met, but preserve diff --git a/mesonbuild/programs.py b/mesonbuild/programs.py index 4b66698..9bf1844 100644 --- a/mesonbuild/programs.py +++ b/mesonbuild/programs.py @@ -26,7 +26,7 @@ from pathlib import Path from . import mesonlib from . import mlog -from .mesonlib import MachineChoice +from .mesonlib import MachineChoice, OrderedSet if T.TYPE_CHECKING: from .environment import Environment @@ -355,15 +355,18 @@ def find_external_program(env: 'Environment', for_machine: MachineChoice, name: display_name: str, default_names: T.List[str], allow_default_for_cross: bool = True) -> T.Generator['ExternalProgram', None, None]: """Find an external program, checking the cross file plus any default options.""" + potential_names = OrderedSet(default_names) + potential_names.add(name) # Lookup in cross or machine file. - potential_cmd = env.lookup_binary_entry(for_machine, name) - if potential_cmd is not None: - mlog.debug(f'{display_name} binary for {for_machine} specified from cross file, native file, ' - f'or env var as {potential_cmd}') - yield ExternalProgram.from_entry(name, potential_cmd) - # We never fallback if the user-specified option is no good, so - # stop returning options. - return + for potential_name in potential_names: + potential_cmd = env.lookup_binary_entry(for_machine, potential_name) + if potential_cmd is not None: + mlog.debug(f'{display_name} binary for {for_machine} specified from cross file, native file, ' + f'or env var as {potential_cmd}') + yield ExternalProgram.from_entry(potential_name, potential_cmd) + # We never fallback if the user-specified option is no good, so + # stop returning options. + return mlog.debug(f'{display_name} binary missing from cross or native file, or env var undefined.') # Fallback on hard-coded defaults, if a default binary is allowed for use # with cross targets, or if this is not a cross target diff --git a/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build index 66a4443..825cd57 100644 --- a/test cases/frameworks/4 qt/meson.build +++ b/test cases/frameworks/4 qt/meson.build @@ -152,7 +152,8 @@ foreach qt : ['qt4', 'qt5', 'qt6'] endif # Check we can apply a version constraint - dependency(qt, modules: qt_modules, version: '>=@0@'.format(qtdep.version()), method : get_option('method')) + accept_versions = ['>=@0@'.format(qtdep.version()), '<@0@'.format(qtdep.version()[0].to_int() + 1)] + dependency(qt, modules: qt_modules, version: accept_versions, method : get_option('method')) endif endforeach |