This is unittest module for waf with builtin google-gtest support. This includes gtest-1.7.0, so you can use gtest without install.
Copy unittest_gtest.py to your project directory.
$ wget http://github.com/tanakh/waf-unittest/raw/master/unittest_gtest.py
Add load('unittest_gtest') to options() and configure().
def options(opt): opt.load('compiler_cxx unittest_gtest')
def configure(conf): conf.load('compiler_cxx unittest_gtest')
Add 'testt' or 'gtest' to your test program's feature.
def build(bld): bld.program(features = 'testt', source = 'test.cpp', includes = '.', target = 'test', use = 'lib GTEST')
# autolink gtest def build(bld): bld.program(features = 'gtest', source = 'test.cpp', includes = '.', target = 'test', use = 'lib')
Build without unittests
$ waf build
Build with unittests and run it (updated only)
$ waf build --check
Build with unittests and run all tests
$ waf build --checkall
Build with a specified unittest and run it (always)
$ waf build --checkone=test
Build with specified unittests by filter pattern (gtest style) and run it (always)
$ waf build --checkfilter=test_target_name.tests.test $ waf build --checkfilter=test_target_name.tests.* $ waf build --checkfilter=*.tests.test
Enjoy!