Repository: mesonbuild/meson

Issue:
AttributeError on switch from 0.40.1 to 0.41.0
On the switch from 0.40.1 to 0.41.1 on Mac OS (installed via brew) I now get the following error:

```
...
WARNING: rcc dependencies will not work reliably until this upstream issue is fixed: https://bugreports.qt.io/browse/QTBUG-45460
Found qmake: qmake (5.9.0)
Dependency QtCore found: YES /usr/local/Cellar/qt/5.9.0/lib/QtCore.framework
Traceback (most recent call last):
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 307, in run
    app.generate()
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 180, in generate
    intr.run()
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 2544, in run
    super().run()
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 125, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 146, in evaluate_codeblock
    raise e
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 140, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 153, in evaluate_statement
    return self.assignment(cur)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 548, in assignment
    value = self.evaluate_statement(node.value)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 151, in evaluate_statement
    return self.function_call(cur)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreterbase.py", line 361, in function_call
    return self.funcs[func_name](node, self.flatten(posargs), kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/interpreter.py", line 1922, in func_dependency
    dep = dependencies.find_external_dependency(name, self.environment, kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/dependencies/base.py", line 610, in find_external_dependency
    dep = packages[lname](env, kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/dependencies/ui.py", line 363, in __init__
    QtBaseDependency.__init__(self, 'qt5', env, kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/dependencies/ui.py", line 183, in __init__
    from_text = self._qmake_detect(mods, kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/dependencies/ui.py", line 283, in _qmake_detect
    return self._framework_detect(qvars, mods, kwargs)
  File "/usr/local/Cellar/meson/0.41.0/lib/python3.6/site-packages/mesonbuild/dependencies/ui.py", line 315, in _framework_detect
    self.cargs.append('-F' + libdir)
AttributeError: 'Qt5Dependency' object has no attribute 'cargs'
```

the same meson.build works fine under Arch Linux using meson 0.41.0, so I cannot rule out either a packaging error in brew or a platform specific problem (or wrong usage on my side). With 0.40.1 and with 0.41.0 on other platforms code works as expected Qt dependencies are correctly found and build succeeds. Qt was installed using brew under Mac OS, too.

The relevant part of the meson.build checking Qt dependencies is:

```
qt5 = import('qt5')
qt5GuiDep = dependency('qt5', modules: [ 'Core', 'Gui'], required: false)
qt5QmlDep = dependency('qt5', modules: 'Qml', required: false)
qt5QuickDep = dependency('qt5', modules: 'Quick', required: false)
qt5WidgetsDep = dependency('qt5', modules: 'Widgets', required: false)
qt5SvgDep = dependency('qt5', modules: 'Svg', required: false)
qt5NetworkDep = dependency('qt5', modules: 'Network', required: false)
qt5LocationDep = dependency('qt5', modules: 'Location', required: false)
```

The error occurs on the first dependency check. The full meson.build can be found at https://github.com/Framstag/libosmscout

If further information are needed just tell me.


Discussion:

Resolving patch:
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -312,7 +312,7 @@ def _framework_detect(self, qvars, modules, kwargs):
             fname = 'Qt' + m
             fwdep = ExtraFrameworkDependency(fname, False, libdir, self.env,
                                              self.language, kwargs)
-            self.cargs.append('-F' + libdir)
+            self.compile_args.append('-F' + libdir)
             if fwdep.found():
                 self.is_found = True
                 self.compile_args += fwdep.get_compile_args()


Test patch: