From 7ac03f62646d40b31b9c1ef1b4f6778c788ec90a Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 28 Apr 2019 23:47:15 +0300 Subject: [PATCH] Non-required appleframework deps should not be an error. Closes #5295. --- mesonbuild/dependencies/platform.py | 13 +++++++++++-- mesonbuild/interpreter.py | 1 + test cases/objc/2 nsstring/meson.build | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mesonbuild/dependencies/platform.py b/mesonbuild/dependencies/platform.py index 9863fb129..e913ed488 100644 --- a/mesonbuild/dependencies/platform.py +++ b/mesonbuild/dependencies/platform.py @@ -16,7 +16,7 @@ # platform-specific (generally speaking). from .base import ExternalDependency, DependencyException - +from ..mesonlib import MesonException class AppleFrameworks(ExternalDependency): def __init__(self, env, kwargs): @@ -31,7 +31,16 @@ class AppleFrameworks(ExternalDependency): raise DependencyException('No C-like compilers are available, cannot find the framework') self.is_found = True for f in self.frameworks: - args = self.clib_compiler.find_framework(f, env, []) + try: + args = self.clib_compiler.find_framework(f, env, []) + except MesonException as e: + if 'non-clang' in str(e): + self.is_found = False + self.link_args = [] + self.compile_args = [] + return + raise + if args is not None: # No compile args are needed for system frameworks self.link_args += args diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8ca7758f5..a3505a4a8 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2996,6 +2996,7 @@ external dependencies (including libraries) must go to "dependencies".''') self._handle_featurenew_dependencies(name) kwargs['required'] = required and not has_fallback dep = dependencies.find_external_dependency(name, self.environment, kwargs) + kwargs['required'] = required # Only store found-deps in the cache # Never add fallback deps to self.coredata.deps since we diff --git a/test cases/objc/2 nsstring/meson.build b/test cases/objc/2 nsstring/meson.build index 7f2483f4c..94d2cf18a 100644 --- a/test cases/objc/2 nsstring/meson.build +++ b/test cases/objc/2 nsstring/meson.build @@ -15,3 +15,6 @@ else endif exe = executable('stringprog', 'stringprog.m', dependencies : dep) test('stringtest', exe) + +# Ensure that a non-required dep that is not found does not cause an error +dependency('appleframeworks', modules: 'nonexisting', required: false)