From: Jannik ZANDER Date: Mon, 16 Jul 2018 16:27:43 +0000 (+0200) Subject: Static lib dependencies X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=53fe8c563077d5be33622975a6dc5dd98a767e2f;p=meson-test.git Static lib dependencies --- diff --git a/folder1/meson.build b/folder1/meson.build index 77cc3d9..cd5280e 100644 --- a/folder1/meson.build +++ b/folder1/meson.build @@ -1,6 +1,5 @@ -# Test 1 -folder1 = 'folder1.c' -folder1_test = executable('test 1', - 'folder1_test.cpp', folder1, - dependencies : gtest) -test('test 1', folder1_test) +folder1_inc = include_directories('') +folder1_lib = static_library('folder1', 'folder1.c') +folder1_dep = declare_dependency(link_with : folder1_lib, include_directories : folder1_inc) +folder1_tst = executable('test1', 'folder1_test.cpp', dependencies : [gtest, folder1_dep]) +test('test 1', folder1_tst) diff --git a/folder2/meson.build b/folder2/meson.build index 9624265..fb87cd2 100644 --- a/folder2/meson.build +++ b/folder2/meson.build @@ -1,8 +1,5 @@ - -# Test 2 -folder1 = '../folder1/folder1.c' -folder2 = 'folder2.c' -folder2_test = executable('test 2', - 'folder2_test.cpp', folder1, folder2, - dependencies : gtest) -test('test 2', folder2_test) +folder2_inc = include_directories('') +folder2_lib = static_library('folder2', 'folder2.c') +folder2_dep = declare_dependency(link_with : folder2_lib, include_directories : folder2_inc, dependencies : folder1_dep) +folder2_tst = executable('test2', 'folder2_test.cpp', dependencies : [gtest, folder2_dep]) +test('test 2', folder2_tst) diff --git a/meson.build b/meson.build index 0fdd14d..1ca8186 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,5 @@ project('meson_test','cpp', 'c') - gtest = dependency('gtest', main : true, required : false) - -# Test 1 subdir('folder1') - -# Test 2 subdir('folder2')