MCPcopy Create free account
hub / github.com/Kitware/CMake / GenDefFile

Method GenDefFile

Source/cmMakefileTargetGenerator.cxx:2341–2385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2339}
2340
2341void cmMakefileTargetGenerator::GenDefFile(
2342 std::vector<std::string>& real_link_commands)
2343{
2344 cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
2345 this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName());
2346 if (!mdi || !mdi->DefFileGenerated) {
2347 return;
2348 }
2349 std::string cmd = cmSystemTools::GetCMakeCommand();
2350 cmd = cmStrCat(
2351 this->LocalGenerator->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL),
2352 " -E __create_def ",
2353 this->LocalGenerator->ConvertToOutputFormat(
2354 this->LocalGenerator->MaybeRelativeToCurBinDir(mdi->DefFile),
2355 cmOutputConverter::SHELL),
2356 ' ');
2357 std::string objlist_file = mdi->DefFile + ".objs";
2358 cmd += this->LocalGenerator->ConvertToOutputFormat(
2359 this->LocalGenerator->MaybeRelativeToCurBinDir(objlist_file),
2360 cmOutputConverter::SHELL);
2361 cmValue const nm_executable = this->Makefile->GetDefinition("CMAKE_NM");
2362 if (cmNonempty(nm_executable)) {
2363 cmd += " --nm=";
2364 cmd += this->LocalCommonGenerator->ConvertToOutputFormat(
2365 *nm_executable, cmOutputConverter::SHELL);
2366 }
2367 real_link_commands.insert(real_link_commands.begin(), cmd);
2368 // create a list of obj files for the -E __create_def to read
2369 cmGeneratedFileStream fout(objlist_file);
2370
2371 if (mdi->WindowsExportAllSymbols) {
2372 for (std::string const& obj : this->Objects) {
2373 if (cmHasLiteralSuffix(obj, ".obj")) {
2374 fout << obj << "\n";
2375 }
2376 }
2377 for (std::string const& obj : this->ExternalObjects) {
2378 fout << obj << "\n";
2379 }
2380 }
2381
2382 for (cmSourceFile const* src : mdi->Sources) {
2383 fout << src->GetFullPath() << "\n";
2384 }
2385}
2386
2387std::string cmMakefileTargetGenerator::GetResponseFlag(
2388 ResponseFlagFor mode) const

Callers 2

WriteExecutableRuleMethod · 0.80
WriteLibraryRulesMethod · 0.80

Calls 10

cmNonemptyFunction · 0.85
cmHasLiteralSuffixFunction · 0.85
cmStrCatFunction · 0.70
ConvertToOutputFormatMethod · 0.45
GetDefinitionMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
GetFullPathMethod · 0.45

Tested by

no test coverage detected