From 1a4fae28ad0b4655068842b64d4e051e88523c07 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Thu, 11 Jul 2019 16:23:37 +0200 Subject: cmake: trace: support interface libraries --- mesonbuild/cmake/traceparser.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'mesonbuild/cmake/traceparser.py') diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py index 3b9f92b..2c62c5d 100644 --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -199,16 +199,23 @@ class CMakeTraceParser: args = list(tline.args) # Make a working copy # Make sure the lib is imported - if 'IMPORTED' not in args: - return self._gen_exception('add_library', 'non imported libraries are not supported', tline) + if 'INTERFACE' in args: + args.remove('INTERFACE') - args.remove('IMPORTED') + if len(args) < 1: + return self._gen_exception('add_library', 'interface library name not specified', tline) - # No only look at the first two arguments (target_name and target_type) and ignore the rest - if len(args) < 2: - return self._gen_exception('add_library', 'requires at least 2 arguments', tline) + self.targets[args[0]] = CMakeTarget(args[0], 'INTERFACE', {}) + elif 'IMPORTED' in args: + args.remove('IMPORTED') - self.targets[args[0]] = CMakeTarget(args[0], args[1], {}) + # No only look at the first two arguments (target_name and target_type) and ignore the rest + if len(args) < 2: + return self._gen_exception('add_library', 'requires at least 2 arguments', tline) + + self.targets[args[0]] = CMakeTarget(args[0], args[1], {}) + else: + return self._gen_exception('add_library', 'non imported / interface libraries are not supported', tline) def _cmake_add_custom_command(self, tline: CMakeTraceLine): # DOC: https://cmake.org/cmake/help/latest/command/add_custom_command.html -- cgit v1.1