Improvements to GTest and GMock.

pull/15/head
Jussi Pakkanen 12 years ago
parent ce4f2f1bbe
commit ea3e8f1dd2
  1. 10
      dependencies.py
  2. 2
      test cases/frameworks/2 gtest/meson.build
  3. 2
      test cases/frameworks/3 gmock/meson.build

@ -265,6 +265,10 @@ class GTestDependency(Dependency):
print('Dependency GTest found: YES') print('Dependency GTest found: YES')
else: else:
print('Dependency GTest found: NO') print('Dependency GTest found: NO')
if kwargs.get('main', False):
self.sources = [self.all_src, self.main_src]
else:
self.sources = [self.all_src]
def found(self): def found(self):
return os.path.exists(self.all_src) return os.path.exists(self.all_src)
@ -281,7 +285,7 @@ class GTestDependency(Dependency):
def get_version(self): def get_version(self):
return '1.something_maybe' return '1.something_maybe'
def get_sources(self): def get_sources(self):
return [self.all_src, self.main_src] return self.sources
class GMockDependency(Dependency): class GMockDependency(Dependency):
def __init__(self, kwargs): def __init__(self, kwargs):
@ -306,8 +310,12 @@ class GMockDependency(Dependency):
self.is_found = True self.is_found = True
self.compile_flags = ['-I' + self.src_include_dir] self.compile_flags = ['-I' + self.src_include_dir]
self.link_flags = [] self.link_flags = []
if kwargs.get('main', False):
self.sources = [self.all_src, self.main_src]
else:
self.sources = [self.all_src] self.sources = [self.all_src]
print('Dependency GMock found: YES') print('Dependency GMock found: YES')
else: else:
print('Dependency GMock found: NO') print('Dependency GMock found: NO')
self.is_found = False self.is_found = False

@ -1,6 +1,6 @@
project('gtest', 'cpp') project('gtest', 'cpp')
gtest = dependency('gtest') gtest = dependency('gtest', main : true)
e = executable('testprog', 'test.cc', deps : gtest) e = executable('testprog', 'test.cc', deps : gtest)
test('gtest test', e) test('gtest test', e)

@ -3,7 +3,7 @@ project('gmock test', 'cpp')
# Using gmock without gtest is a pain so just # Using gmock without gtest is a pain so just
# don't support that then. # don't support that then.
gtest = dependency('gtest') gtest = dependency('gtest', main : true)
gmock = dependency('gmock') gmock = dependency('gmock')
e = executable('gmocktest', 'gmocktest.cc', deps : [gtest, gmock]) e = executable('gmocktest', 'gmocktest.cc', deps : [gtest, gmock])

Loading…
Cancel
Save