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

Method AddAutomaticSources

Source/cmGlobalGenerator.cxx:1960–2002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1958}
1959
1960bool cmGlobalGenerator::AddAutomaticSources()
1961{
1962 for (auto const& lg : this->LocalGenerators) {
1963 for (auto const& gt : lg->GetGeneratorTargets()) {
1964 if (!gt->CanCompileSources()) {
1965 continue;
1966 }
1967 lg->AddUnityBuild(gt.get());
1968 lg->AddISPCDependencies(gt.get());
1969 // Targets that reuse a PCH are handled below.
1970 if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
1971 lg->AddPchDependencies(gt.get());
1972 }
1973 lg->AddXCConfigSources(gt.get());
1974 }
1975 }
1976 for (auto const& lg : this->LocalGenerators) {
1977 for (auto const& gt : lg->GetGeneratorTargets()) {
1978 if (!gt->CanCompileSources()) {
1979 continue;
1980 }
1981 // Handle targets that reuse a PCH from an above-handled target.
1982 if (gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
1983 lg->AddPchDependencies(gt.get());
1984 }
1985 }
1986 }
1987 // The above transformations may have changed the classification of sources,
1988 // e.g., sources that go into unity builds become SourceKindUnityBatched.
1989 // Clear the source list and classification cache (KindedSources) of all
1990 // targets so that it will be recomputed correctly by the generators later
1991 // now that the above transformations are done for all targets.
1992 // Also clear the link interface cache to support $<TARGET_OBJECTS:objlib>
1993 // in INTERFACE_LINK_LIBRARIES because the list of object files may have
1994 // been changed by conversion to a unity build or addition of a PCH source.
1995 for (auto const& lg : this->LocalGenerators) {
1996 for (auto const& gt : lg->GetGeneratorTargets()) {
1997 gt->ClearSourcesCache();
1998 gt->ClearLinkInterfaceCache();
1999 }
2000 }
2001 return true;
2002}
2003
2004std::unique_ptr<cmLinkLineComputer> cmGlobalGenerator::CreateLinkLineComputer(
2005 cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const

Callers 1

ComputeMethod · 0.95

Calls 9

AddUnityBuildMethod · 0.80
AddISPCDependenciesMethod · 0.80
AddPchDependenciesMethod · 0.80
ClearSourcesCacheMethod · 0.80
CanCompileSourcesMethod · 0.45
getMethod · 0.45
GetPropertyMethod · 0.45
AddXCConfigSourcesMethod · 0.45

Tested by

no test coverage detected