aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/ast/introspection.py3
-rw-r--r--test cases/unit/53 introspect buildoptions/main.c6
-rw-r--r--test cases/unit/53 introspect buildoptions/meson.build5
3 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index 0917015..f0ff43f 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -142,10 +142,11 @@ class IntrospectionInterpreter(AstInterpreter):
}]
def build_target(self, node, args, kwargs, targetclass):
+ args = self.flatten_args(args)
if not args:
return
kwargs = self.flatten_kwargs(kwargs, True)
- name = self.flatten_args(args)[0]
+ name = args[0]
srcqueue = [node]
if 'sources' in kwargs:
srcqueue += kwargs['sources']
diff --git a/test cases/unit/53 introspect buildoptions/main.c b/test cases/unit/53 introspect buildoptions/main.c
new file mode 100644
index 0000000..ef99ae6
--- /dev/null
+++ b/test cases/unit/53 introspect buildoptions/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main() {
+ printf("Hello World");
+ return 0;
+}
diff --git a/test cases/unit/53 introspect buildoptions/meson.build b/test cases/unit/53 introspect buildoptions/meson.build
index e94ef61..8052b5f 100644
--- a/test cases/unit/53 introspect buildoptions/meson.build
+++ b/test cases/unit/53 introspect buildoptions/meson.build
@@ -2,6 +2,11 @@ project('introspect buildargs', ['c'], default_options: ['c_std=c11', 'cpp_std=c
subA = subproject('projectA')
+target_name = 'MAIN'
+target_src = ['main.c']
+
+executable(target_name, target_src)
+
r = run_command(find_program('c_compiler.py'))
if r.returncode() != 0
error('FAILED')