Make the gtest dependency optional.

This is needed to build in flatpak.
This commit is contained in:
Matthieu Gautier 2019-08-12 15:31:16 +02:00
parent 1e0c9a120a
commit 3e3e1683f5
3 changed files with 16 additions and 9 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea/ .idea/
*.swp

1
subprojects/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
gtest

View File

@ -7,13 +7,18 @@ tests = [
] ]
gtest_dep = dependency('gtest', main:true, fallback: ['gtest', 'gtest_dep']) gtest_dep = dependency('gtest',
main:true,
fallback: ['gtest', 'gtest_dep'],
required:false)
foreach test_name : tests if gtest_dep.found()
test_exe = executable(test_name, [test_name+'.cpp'], foreach test_name : tests
link_with : kiwixlib, test_exe = executable(test_name, [test_name+'.cpp'],
link_args: extra_link_args, link_with : kiwixlib,
dependencies : all_deps + [gtest_dep], link_args: extra_link_args,
build_rpath : '$ORIGIN') dependencies : all_deps + [gtest_dep],
test(test_name, test_exe) build_rpath : '$ORIGIN')
endforeach test(test_name, test_exe)
endforeach
endif