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

Method GetSource

Source/cmMakefile.cxx:3061–3086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3059}
3060
3061cmSourceFile* cmMakefile::GetSource(std::string const& sourceName,
3062 cmSourceFileLocationKind kind) const
3063{
3064 // First check "Known" paths (avoids the creation of cmSourceFileLocation)
3065 if (kind == cmSourceFileLocationKind::Known) {
3066 auto sfsi = this->KnownFileSearchIndex.find(sourceName);
3067 if (sfsi != this->KnownFileSearchIndex.end()) {
3068 return sfsi->second;
3069 }
3070 }
3071
3072 cmSourceFileLocation sfl(this, sourceName, kind);
3073 auto name = this->GetCMakeInstance()->StripExtension(sfl.GetName());
3074#if defined(_WIN32) || defined(__APPLE__)
3075 name = cmSystemTools::LowerCase(name);
3076#endif
3077 auto sfsi = this->SourceFileSearchIndex.find(name);
3078 if (sfsi != this->SourceFileSearchIndex.end()) {
3079 for (auto* sf : sfsi->second) {
3080 if (sf->Matches(sfl)) {
3081 return sf;
3082 }
3083 }
3084 }
3085 return nullptr;
3086}
3087
3088cmSourceFile* cmMakefile::CreateSource(std::string const& sourceName,
3089 bool generated,

Callers 15

GetOrCreateSourceMethod · 0.95
ExpandLinkItemsMethod · 0.80
WriteMakeRuleMethod · 0.80
cmQTWrapUICommandFunction · 0.80
GetRealDependencyMethod · 0.80
AddCustomCommandFunction · 0.80

Calls 6

GetCMakeInstanceMethod · 0.95
StripExtensionMethod · 0.80
findMethod · 0.45
endMethod · 0.45
GetNameMethod · 0.45
MatchesMethod · 0.45

Tested by

no test coverage detected