def test_local_options(self): env = make_env('winnt', clear_variables=True, variables={'CXX': 'nonexist'}) build, context = self._make_context(env) with mock.patch('bfg9000.tools.c_family._builders', (MsvcBuilder,)), \ mock.patch('logging.log'): context['global_options'](opts.debug(), lang='c++') src = context['source_file']('main.cpp') result = context['object_file'](file=src, options=[opts.static()]) makefile = make.Makefile(None) with mock.patch.object(make.Makefile, 'rule') as mrule, \ mock.patch.object(make.Makefile, 'variable', wraps=makefile.variable) as mvar, \ mock.patch('logging.log'): compile.make_compile(result.creator, build, makefile, env) mrule.assert_called_once_with(result, [src], [], AlwaysEqual(), { make.var('CXXFLAGS'): [make.var('GLOBAL_CXXFLAGS'), '/MTd'] }, None) mvar.assert_any_call('GLOBAL_CXXFLAGS', ['/Zi'], make.Section.flags, True)
def _variables(self, lang='c++'): linker = self.env.builder(lang).linker('executable') libs = linker.lib_flags(linker.always_libs(True)) if libs: return {make.var('LDLIBS'): [make.var('GLOBAL_LDLIBS')] + libs} return {}