From d2d567421ae077153868cf6ed3f004e9a0d9def5 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Tue, 17 Jul 2018 13:49:24 +0200 Subject: [PATCH] Final --- meson.build | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index f2c1c5b..dd5e46d 100644 --- a/meson.build +++ b/meson.build @@ -1,22 +1,19 @@ project('meson_test','cpp', 'c') -gtest_sub = subproject('gtest') +gtest = dependency('gtest', main : true, required : false) -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')] +if not gtest.found() + gtest_sub = subproject('gtest') + 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) + gtest = declare_dependency(link_with : gtest_lib, + include_directories : gtest_inc, + dependencies: dependency('threads')) +endif -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') subdir('folder1_test') subdir('folder2') -- 2.43.0