From 383d21ac94424537098c8e69fd2279310c3e2db4 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Tue, 17 Jul 2018 13:13:30 +0200 Subject: [PATCH] Static gtest lib --- folder1_test/meson.build | 4 ++-- folder2/meson.build | 4 ++-- folder2_test/meson.build | 4 ++-- meson.build | 15 +++++++++++++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/folder1_test/meson.build b/folder1_test/meson.build index af74b29..f978e4e 100644 --- a/folder1_test/meson.build +++ b/folder1_test/meson.build @@ -1,4 +1,4 @@ -folder1_tst = executable('test1', - sources : ['folder1_test.cpp'], +folder1_tst = executable('folder1_test', + sources : ['folder1_test.cpp'], dependencies : [gtest, folder1_dep]) test('Test independent component', folder1_tst) diff --git a/folder2/meson.build b/folder2/meson.build index 0167536..223a3c8 100644 --- a/folder2/meson.build +++ b/folder2/meson.build @@ -1,5 +1,5 @@ folder2_src = ['folder2.c'] folder2_inc = include_directories('.') -folder2_dep = declare_dependency(sources: folder2_src, - include_directories : folder2_inc, +folder2_dep = declare_dependency(sources: folder2_src, + include_directories : folder2_inc, dependencies: folder1_dep) diff --git a/folder2_test/meson.build b/folder2_test/meson.build index 5d09166..48076ad 100644 --- a/folder2_test/meson.build +++ b/folder2_test/meson.build @@ -1,4 +1,4 @@ -folder2_tst = executable('test2', - sources : ['folder2_test.cpp'], +folder2_tst = executable('folder2_test', + sources : ['folder2_test.cpp'], dependencies : [gtest, folder2_dep]) test('Test component depending on another component', folder2_tst) diff --git a/meson.build b/meson.build index 5d2eae0..f2c1c5b 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,20 @@ project('meson_test','cpp', 'c') - gtest_sub = subproject('gtest') -gtest = gtest_sub.get_variable('gtest_main_dep') +gtest_inc = gtest_sub.get_variable('gtest_incdir') +gtest_src = [gtest_sub.get_variable('gtest_libsources'), + gtest_sub.get_variable('gtest_mainsources')] +#gtest_dep = [gtest_sub.get_variable('gtest_main_dep'), +# dependency('threads')] + +gtest_lib = static_library('gtest_lib', sources: gtest_src, + include_directories: gtest_inc) +# dependencies : gtest_dep) + +gtest = declare_dependency(include_directories : gtest_inc, + link_with : gtest_lib, + dependencies: dependency('threads')) subproject('gtest') subdir('folder1') -- 2.43.0