Make the gtest dependency optional. (#253)

Make the gtest dependency optional.
This commit is contained in:
Matthieu Gautier 2019-08-12 15:59:31 +02:00 committed by GitHub
commit a8668db2fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.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
test_exe = executable(test_name, [test_name+'.cpp'],
link_with : kiwixlib,
link_args: extra_link_args,
dependencies : all_deps + [gtest_dep],
build_rpath : '$ORIGIN')
test(test_name, test_exe)
endforeach
if gtest_dep.found()
foreach test_name : tests
test_exe = executable(test_name, [test_name+'.cpp'],
link_with : kiwixlib,
link_args: extra_link_args,
dependencies : all_deps + [gtest_dep],
build_rpath : '$ORIGIN')
test(test_name, test_exe)
endforeach
endif