target = 'test' tests = Split(""" endian.cpp mmap.cpp specmatch.cpp textrunner.cpp """) required = Split(""" dirreader.cpp growbuf.cpp mmap.cpp """) libs = Split(""" cppunit """) Import('env') # compile using msvcrt (that's how cppunit.lib is built) if 'msvc' in env['TOOLS'] or 'mstoolkit' in env['TOOLS']: env.Append(CCFLAGS = ['/MD']) # uses exceptions env.Append(CCFLAGS = ['$EXCEPTION_FLAG']) # test for CppUnit conf = env.Configure() if not conf.CheckLibWithHeader(libs, 'cppunit/extensions/HelperMacros.h', 'C++'): if 'test' in BUILD_TARGETS: print '*** error: CppUnit must be installed for testing!' Exit(1) conf.Finish() # compile files from parent directory required_obj = [] for i in required: b = 'required/%s' % i[:-4] s = '#Source/%s' % i o = env.Object(b, s) required_obj.append(o) # build test program tests = env.Program(target, tests + required_obj, LIBS = libs) # alias running the test to 'test' test = env.Alias('test', [tests], tests[0].abspath) # always test when asked to AlwaysBuild(test)