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

Method GetTargetObjectLocations

Source/cmGeneratorTarget.cxx:4090–4133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4088}
4089
4090void cmGeneratorTarget::GetTargetObjectLocations(
4091 std::string const& config,
4092 std::function<void(cmObjectLocation const&, cmObjectLocation const&)> cb)
4093 const
4094{
4095 std::vector<cmSourceFile const*> objectSources;
4096 this->GetObjectSources(objectSources, config);
4097 std::map<cmSourceFile const*, cmObjectLocations> mapping;
4098
4099 for (cmSourceFile const* sf : objectSources) {
4100 mapping[sf];
4101 }
4102
4103 this->LocalGenerator->ComputeObjectFilenames(mapping, config, this);
4104
4105 auto const buildUseShortPaths = this->GetUseShortObjectNames()
4106 ? cmObjectLocations::UseShortPath::Yes
4107 : cmObjectLocations::UseShortPath::No;
4108 auto const installUseShortPaths = this->GetUseShortObjectNamesForInstall();
4109
4110 for (cmSourceFile const* src : objectSources) {
4111 // Find the object file name corresponding to this source file.
4112 auto map_it = mapping.find(src);
4113 auto const& buildLoc = map_it->second.GetLocation(buildUseShortPaths);
4114 auto const& installLoc =
4115 map_it->second.GetInstallLocation(installUseShortPaths, config);
4116 // It must exist because we populated the mapping just above.
4117 assert(!buildLoc.GetPath().empty());
4118 assert(!installLoc.GetPath().empty());
4119 cb(buildLoc, installLoc);
4120 }
4121
4122 // We need to compute the relative path from the root of
4123 // of the object directory to handle subdirectory paths
4124 std::string rootObjectDir = this->GetObjectDirectory(config);
4125 rootObjectDir = cmSystemTools::CollapseFullPath(rootObjectDir);
4126 auto ispcObjects = this->GetGeneratedISPCObjects(config);
4127 for (std::string const& output : ispcObjects) {
4128 auto relativePathFromObjectDir = output.substr(rootObjectDir.size());
4129 cmObjectLocation ispcLoc(relativePathFromObjectDir);
4130 // FIXME: apply short path to this object if needed.
4131 cb(ispcLoc, ispcLoc);
4132 }
4133}
4134
4135bool cmGeneratorTarget::StrictTargetComparison::operator()(
4136 cmGeneratorTarget const* t1, cmGeneratorTarget const* t2) const

Callers 3

GetTargetObjectNamesMethod · 0.95
GetFilesMethod · 0.80
GetInstallObjectNamesMethod · 0.80

Calls 13

GetObjectSourcesMethod · 0.95
GetObjectDirectoryMethod · 0.95
GetInstallLocationMethod · 0.80
GetPathMethod · 0.80
findMethod · 0.45
GetLocationMethod · 0.45
emptyMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected