From: Jannik ZANDER Date: Tue, 17 Jul 2018 18:18:05 +0000 (+0200) Subject: Glob subdirs (problem w dependencies) X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;p=meson-test.git Glob subdirs (problem w dependencies) --- diff --git a/folder1/meson.build b/folder1/meson.build index 55eec19..b3f16d5 100644 --- a/folder1/meson.build +++ b/folder1/meson.build @@ -1,4 +1,4 @@ -folder1_src = ['folder1.c'] +folder1_src = files(['folder1.c']) folder1_inc = include_directories('.') folder1_dep = declare_dependency(sources: folder1_src, include_directories : folder1_inc) diff --git a/folder2/meson.build b/folder2/meson.build index 223a3c8..2358cdb 100644 --- a/folder2/meson.build +++ b/folder2/meson.build @@ -1,4 +1,4 @@ -folder2_src = ['folder2.c'] +folder2_src = files(['folder2.c']) folder2_inc = include_directories('.') folder2_dep = declare_dependency(sources: folder2_src, include_directories : folder2_inc, diff --git a/meson.build b/meson.build index dd5e46d..b3cb050 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,9 @@ project('meson_test','cpp', 'c') gtest = dependency('gtest', main : true, required : false) - if not gtest.found() gtest_sub = subproject('gtest') - gtest_src = [gtest_sub.get_variable('gtest_libsources'), - gtest_sub.get_variable('gtest_mainsources')] + gtest_src = [gtest_sub.get_variable('gtest_libsources'), gtest_sub.get_variable('gtest_mainsources')] gtest_inc = gtest_sub.get_variable('gtest_incdir') gtest_lib = static_library('gtest', sources: gtest_src, include_directories: gtest_inc) @@ -14,8 +12,13 @@ if not gtest.found() dependencies: dependency('threads')) endif -subdir('folder1') -subdir('folder1_test') -subdir('folder2') -subdir('folder2_test') +py3 = import('python3').find_python() +ret = run_command(py3, '-c', 'import glob\ndirs = glob.glob("**/meson.build")\nfor d in sorted(dirs): print(d[:-12])') +dirs = [] +if ret.returncode() == 0 + dirs += ret.stdout().split() +endif +foreach d : dirs + subdir(d) +endforeach