Merge topic 'use-generator-target'

c2b7336f cmGeneratorTarget: Move GetConfigCommonSourceFiles from cmTarget.
69329fff cmGeneratorTarget: Move GetLanguages from cmTarget.
0431f2c4 cmGeneratorTarget: Move ComputeLinkImplementationLanguages from cmTarget.
abe9505d cmGeneratorTarget: Move HaveBuildTreeRPath from cmTarget.
d4a24c0e cmGeneratorTarget: Move GetLinkImplementation from cmTarget.
83981cf5 cmTarget: Add GetLinkImplMap method.
771e79a2 cmLinkItem: Add cmOptionalLinkImplementation type.
3846ebcf cmLinkItem: Add cmLinkImplementation type.
a7f5d70d cmGeneratorTarget: Move compile defintions processing from cmTarget.
d051086c cmGeneratorTarget: Move compile features processing from cmTarget.
db4cb92b cmGeneratorTarget: Move compile options processing from cmTarget.
e6ccbf6f cmGeneratorTarget: Move include directory processing from cmTarget.
8bfb0c53 cmGeneratorTarget: Move link iface helpers from cmTarget.
2cb3e574 cmGeneratorTarget: Move GetImportLinkInterface from cmTarget.
6d3d099b cmGeneratorTarget: Move ComputeLinkInterfaceLibraries from cmTarget.
0db9d927 cmGeneratorTarget: Move GetLinkInterfaceLibraries from cmTarget.
...
This commit is contained in:
Brad King 2015-08-27 10:07:32 -04:00 committed by CMake Topic Stage
commit 27e4b21dfa
25 changed files with 1527 additions and 1371 deletions

View File

@ -362,9 +362,11 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
// Follow the item's dependencies.
if(entry.Target)
{
cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(entry.Target);
// Follow the target dependencies.
if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
if(cmLinkInterface const* iface =
gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@ -398,7 +400,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
//----------------------------------------------------------------------------
void
cmComputeLinkDepends
::FollowSharedDeps(int depender_index, cmTarget::LinkInterface const* iface,
::FollowSharedDeps(int depender_index, cmLinkInterface const* iface,
bool follow_interface)
{
// Follow dependencies if we have not followed them already.
@ -461,8 +463,10 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Target items may have their own dependencies.
if(entry.Target)
{
if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target->Target))
cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(entry.Target);
if(cmLinkInterface const* iface =
gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
// Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true);
@ -552,8 +556,8 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
void cmComputeLinkDepends::AddDirectLinkEntries()
{
// Add direct link dependencies in this configuration.
cmTarget::LinkImplementation const* impl =
this->Target->Target->GetLinkImplementation(this->Config);
cmLinkImplementation const* impl =
this->Target->GetLinkImplementation(this->Config);
this->AddLinkEntries(-1, impl->Libraries);
for(std::vector<cmLinkItem>::const_iterator
wi = impl->WrongConfigLibraries.begin();
@ -932,8 +936,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
{
if(cmTarget const* target = this->EntryList[*ni].Target)
{
if(cmTarget::LinkInterface const* iface =
target->GetLinkInterface(this->Config, this->Target->Target))
cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(target);
if(cmLinkInterface const* iface =
gtgt->GetLinkInterface(this->Config, this->Target->Target))
{
if(iface->Multiplicity > count)
{

View File

@ -102,7 +102,7 @@ private:
std::queue<SharedDepEntry> SharedDepQueue;
std::set<int> SharedDepFollowed;
void FollowSharedDeps(int depender_index,
cmTarget::LinkInterface const* iface,
cmLinkInterface const* iface,
bool follow_interface = false);
void QueueSharedDependencies(int depender_index,
std::vector<cmLinkItem> const& deps);

View File

@ -1925,7 +1925,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
(outputRuntime && this->Target->Target->HaveInstallTreeRPATH() &&
linking_for_install);
bool use_build_rpath =
(outputRuntime && this->Target->Target->HaveBuildTreeRPATH(this->Config) &&
(outputRuntime && this->Target->HaveBuildTreeRPATH(this->Config) &&
!linking_for_install);
bool use_link_rpath =
outputRuntime && linking_for_install &&

View File

@ -252,8 +252,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
}
}
cmTarget::LinkImplementation const* impl =
depender->Target->GetLinkImplementation(*it);
cmLinkImplementation const* impl = depender->GetLinkImplementation(*it);
// A target should not depend on itself.
emitted.insert(depender->GetName());
@ -296,8 +295,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
std::set<std::string> &emitted)
{
cmGeneratorTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
dependee->Target->GetLinkInterface(config,
if(cmLinkInterface const* iface =
dependee->GetLinkInterface(config,
depender->Target))
{
for(std::vector<cmLinkItem>::const_iterator

View File

@ -796,9 +796,8 @@ cmExportFileGenerator
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
config,
target->Target);
cmLinkInterface const* iface = target->GetLinkInterface(config,
target->Target);
if (!iface)
{
return;
@ -909,9 +908,8 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
if(cmTarget::LinkInterface const* iface =
target->Target
->GetLinkInterface(config, target->Target))
if(cmLinkInterface const* iface =
target->GetLinkInterface(config, target->Target))
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",

View File

@ -609,7 +609,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
// the compilerdefines for this target
std::vector<std::string> cdefs;
target->GetCompileDefinitions(cdefs, buildType, "C");
gtgt->GetCompileDefinitions(cdefs, buildType, "C");
// Expand the list.
for(std::vector<std::string>::const_iterator di = cdefs.begin();

View File

@ -1108,8 +1108,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if(isInterfaceProperty)
{
if(cmTarget::LinkInterfaceLibraries const* iface =
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
if(cmLinkInterfaceLibraries const* iface =
gtgt->GetLinkInterfaceLibraries(context->Config, headTarget, true))
{
linkedTargetsContent =
getLinkedTargetsContent(iface->Libraries, target,

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
#ifndef cmGeneratorTarget_h
#define cmGeneratorTarget_h
#include "cmStandardIncludes.h"
#include "cmLinkItem.h"
class cmCustomCommand;
class cmGlobalGenerator;
@ -106,6 +106,21 @@ public:
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const std::string& config) const;
cmLinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
void ComputeLinkInterface(const std::string& config,
cmOptionalLinkInterface& iface,
cmTarget const* head) const;
cmLinkInterfaceLibraries const*
GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget,
bool usage_requirements_only) const;
void ComputeLinkInterfaceLibraries(const std::string& config,
cmOptionalLinkInterface &iface,
cmTarget const* head,
bool usage_requirements_only) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
@ -183,6 +198,25 @@ public:
LinkClosure const* GetLinkClosure(const std::string& config) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
cmLinkImplementation const*
GetLinkImplementation(const std::string& config) const;
void ComputeLinkImplementationLanguages(const std::string& config,
cmOptionalLinkImplementation& impl
) const;
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
// when source file properties are changed and we do not have enough
// information to forward these property changes to the targets
// until we have per-target object file properties.
void GetLanguages(std::set<std::string>& languages,
std::string const& config) const;
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
bool HaveBuildTreeRPATH(const std::string& config) const;
/** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */
@ -202,6 +236,17 @@ public:
std::vector<std::string> GetIncludeDirectories(
const std::string& config, const std::string& lang) const;
void GetCompileOptions(std::vector<std::string> &result,
const std::string& config,
const std::string& language) const;
void GetCompileFeatures(std::vector<std::string> &features,
const std::string& config) const;
void GetCompileDefinitions(std::vector<std::string> &result,
const std::string& config,
const std::string& language) const;
bool IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const;
@ -317,6 +362,8 @@ public:
const std::string &report,
const std::string &compatibilityType) const;
class TargetPropertyEntry;
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@ -375,9 +422,41 @@ private:
};
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
typedef std::map<std::string, cmHeadToLinkInterfaceMap>
LinkInterfaceMapType;
mutable LinkInterfaceMapType LinkInterfaceMap;
mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
cmHeadToLinkInterfaceMap&
GetHeadToLinkInterfaceMap(std::string const& config) const;
cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
std::string const& config) const;
cmLinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head,
bool usage_requirements_only) const;
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget,
bool usage_requirements_only,
std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition) const;
void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const;
typedef std::pair<std::string, bool> OutputNameKey;
typedef std::map<OutputNameKey, std::string> OutputNameMapType;
mutable OutputNameMapType OutputNameMap;
mutable bool PolicyWarnedCMP0022;
mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileFeaturesDone;
mutable bool DebugCompileDefinitionsDone;
public:
std::vector<cmTarget const*> const&

View File

@ -330,7 +330,8 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
const std::string &config, const std::string &language)
{
std::vector<std::string> compileDefinitions;
this->Target->GetCompileDefinitions(compileDefinitions, config, language);
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions,
config, language);
for (std::vector<std::string>::const_iterator cdI =
compileDefinitions.begin();
cdI != compileDefinitions.end(); ++cdI)
@ -343,7 +344,7 @@ void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config,
const std::string &language)
{
std::vector<std::string> includes =
this->Target->GetIncludeDirectories(config, language);
this->GeneratorTarget->GetIncludeDirectories(config, language);
for (std::vector<std::string>::const_iterator includes_i = includes.begin();
includes_i != includes.end(); ++includes_i)
{
@ -558,7 +559,7 @@ bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config,
{
bool output;
std::vector<std::string> options;
this->Target->GetCompileOptions(options, config, language);
this->GeneratorTarget->GetCompileOptions(options, config, language);
output =
options.end() == std::find(options.begin(), options.end(), "-kernel");
return output;
@ -587,7 +588,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload(
{
std::vector<std::string> options;
bool output = false;
this->Target->GetCompileOptions(options, config, language);
this->GeneratorTarget->GetCompileOptions(options, config, language);
for (std::vector<std::string>::const_iterator options_i = options.begin();
options_i != options.end(); ++options_i)
{

View File

@ -1550,7 +1550,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
t->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;

View File

@ -1145,7 +1145,8 @@ bool cmGlobalUnixMakefileGenerator3
::NeedRequiresStep(cmTarget const& target)
{
std::set<std::string> languages;
target.GetLanguages(languages,
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&target);
gtgt->GetLanguages(languages,
target.GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)

View File

@ -254,7 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
no_working_directory, no_depends,
noCommandLines);
tgt->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
mf->AddGeneratorTarget(tgt, gt);

View File

@ -90,7 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute()
AddUtilityCommand("ALL_BUILD", true, no_working_dir,
no_depends, no_commands, false,
"Build all projects");
allBuild->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
@ -836,17 +836,19 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
bool
cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
{
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
// check to see if this is a fortran build
std::set<std::string> languages;
{
// Issue diagnostic if the source files depend on the config.
std::vector<cmSourceFile*> sources;
if (!target.GetConfigCommonSourceFiles(sources))
if (!gt->GetConfigCommonSourceFiles(sources))
{
return false;
}
}
target.GetLanguages(languages, "");
gt->GetLanguages(languages, "");
if(languages.size() == 1)
{
if(*languages.begin() == "Fortran")

View File

@ -463,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
no_working_directory,
"echo", "Build all projects");
allbuild->Compute();
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
mf->AddGeneratorTarget(allbuild, allBuildGt);
@ -498,7 +498,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
true, no_depends,
no_working_directory,
"make", "-f", file.c_str());
check->Compute();
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
mf->AddGeneratorTarget(check, checkGt);
}
@ -1124,7 +1124,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// organize the sources
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return false;
}
@ -1383,8 +1383,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
if(llang.empty()) { return; }
// If the language is compiled as a source trust Xcode to link with it.
cmTarget::LinkImplementation const* impl =
cmtarget.GetLinkImplementation("NOCONFIG");
cmLinkImplementation const* impl =
gtgt->GetLinkImplementation("NOCONFIG");
for(std::vector<std::string>::const_iterator li = impl->Languages.begin();
li != impl->Languages.end(); ++li)
{
@ -1505,7 +1505,8 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
}
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return;
}
@ -1805,7 +1806,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// Compute the compilation flags for each language.
std::set<std::string> languages;
target.GetLanguages(languages, configName);
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
gtgt->GetLanguages(languages, configName);
std::map<std::string, std::string> cflags;
for (std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li)
@ -1827,7 +1829,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
AddCompileOptions(flags, &target, lang, configName);
}
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
std::string llang = gtgt->GetLinkerLanguage(configName);
if(binary && llang.empty())
{
@ -1855,7 +1856,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs, exportMacro);
}
std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName, "C");
gtgt->GetCompileDefinitions(targetDefines, configName, "C");
this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
@ -2557,7 +2558,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
if(cmtarget.GetType() == cmTarget::UTILITY)
{
std::vector<cmSourceFile*> sources;
if (!cmtarget.GetConfigCommonSourceFiles(sources))
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if (!gtgt->GetConfigCommonSourceFiles(sources))
{
return 0;
}
@ -3085,7 +3087,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
if (!gtgt->GetConfigCommonSourceFiles(classes))
{
return false;
}

View File

@ -56,4 +56,66 @@ struct cmLinkImplementationLibraries
std::vector<cmLinkItem> WrongConfigLibraries;
};
struct cmLinkInterfaceLibraries
{
// Libraries listed in the interface.
std::vector<cmLinkItem> Libraries;
};
struct cmLinkInterface: public cmLinkInterfaceLibraries
{
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
// Shared library dependencies needed for linking on some platforms.
std::vector<cmLinkItem> SharedDeps;
// Number of repetitions of a strongly connected component of two
// or more static libraries.
int Multiplicity;
// Libraries listed for other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
bool ImplementationIsInterface;
cmLinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
};
struct cmOptionalLinkInterface: public cmLinkInterface
{
cmOptionalLinkInterface():
LibrariesDone(false), AllDone(false),
Exists(false), HadHeadSensitiveCondition(false),
ExplicitLibraries(0) {}
bool LibrariesDone;
bool AllDone;
bool Exists;
bool HadHeadSensitiveCondition;
const char* ExplicitLibraries;
};
struct cmHeadToLinkInterfaceMap:
public std::map<cmTarget const*, cmOptionalLinkInterface>
{
};
struct cmLinkImplementation: public cmLinkImplementationLibraries
{
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
// Cache link implementation computation from each configuration.
struct cmOptionalLinkImplementation: public cmLinkImplementation
{
cmOptionalLinkImplementation():
LibrariesDone(false), LanguagesDone(false),
HadHeadSensitiveCondition(false) {}
bool LibrariesDone;
bool LanguagesDone;
bool HadHeadSensitiveCondition;
};
#endif

View File

@ -1079,7 +1079,8 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
const std::string& lang)
{
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines, config, lang);
cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(target);
gtgt->GetCompileDefinitions(targetDefines, config, lang);
this->AppendDefines(defines, targetDefines);
}
@ -1090,6 +1091,10 @@ void cmLocalGenerator::AddCompileOptions(
)
{
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
cmGeneratorTarget* gtgt =
this->GlobalGenerator->GetGeneratorTarget(target);
if(const char* langFlagRegexStr =
this->Makefile->GetDefinition(langFlagRegexVar))
{
@ -1100,7 +1105,7 @@ void cmLocalGenerator::AddCompileOptions(
{
cmSystemTools::ParseWindowsCommandLine(targetFlags, opts);
}
target->GetCompileOptions(opts, config, lang);
gtgt->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i)
{
@ -1121,7 +1126,7 @@ void cmLocalGenerator::AddCompileOptions(
this->AppendFlags(flags, targetFlags);
}
std::vector<std::string> opts;
target->GetCompileOptions(opts, config, lang);
gtgt->GetCompileOptions(opts, config, lang);
for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i)
{
@ -1130,7 +1135,7 @@ void cmLocalGenerator::AddCompileOptions(
}
}
std::vector<std::string> features;
target->GetCompileFeatures(features, config);
gtgt->GetCompileFeatures(features, config);
for(std::vector<std::string>::const_iterator it = features.begin();
it != features.end(); ++it)
{

View File

@ -1257,7 +1257,9 @@ cmLocalUnixMakefileGenerator3
{
// Get the set of source languages in the target.
std::set<std::string> languages;
target.GetLanguages(languages,
cmGeneratorTarget *gtgt =
this->GlobalGenerator->GetGeneratorTarget(&target);
gtgt->GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"

View File

@ -305,9 +305,12 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// get the classes from the source lists then add them to the groups
std::vector<cmSourceFile*> classes;
if (!target.GetConfigCommonSourceFiles(classes))
if (!gt->GetConfigCommonSourceFiles(classes))
{
return;
}

View File

@ -763,7 +763,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish();
std::vector<std::string> targetDefines;
target.GetCompileDefinitions(targetDefines, configName, "CXX");
gt->GetCompileDefinitions(targetDefines, configName, "CXX");
targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
@ -1469,10 +1469,13 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// get the classes from the source lists then add them to the groups
this->ModuleDefinitionFile = "";
std::vector<cmSourceFile*> classes;
if (!target.GetConfigCommonSourceFiles(classes))
if (!gt->GetConfigCommonSourceFiles(classes))
{
return;
}
@ -1514,8 +1517,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
{
// VS >= 8 support per-config source locations so we
// list object library content as external objects.
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> objs;
gt->UseObjectLibraries(objs, "");
if(!objs.empty())

View File

@ -276,7 +276,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
std::set<std::string> languages;
this->Target->GetLanguages(languages,
this->GeneratorTarget->GetLanguages(languages,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
// put the compiler in the rules.make file so that if it changes
// things rebuild

View File

@ -403,7 +403,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
)
{
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
cmGeneratorTarget* gtgt =
lg->GetGlobalGenerator()->GetGeneratorTarget(target);
gtgt->GetConfigCommonSourceFiles(srcFiles);
for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end();
++fileIt)
@ -474,8 +476,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
/*byproducts=*/rcc_output, depends,
commandLines, false, autogenComment.c_str());
autogenTarget->Compute();
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
makefile->AddGeneratorTarget(autogenTarget, gt);
@ -663,7 +663,10 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
const char* sepHeaders = "";
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
gtgt->GetConfigCommonSourceFiles(srcFiles);
const char *skipMocSep = "";
const char *skipUicSep = "";
@ -1048,7 +1051,10 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
cmMakefile *makefile = target->GetMakefile();
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
gtgt->GetConfigCommonSourceFiles(srcFiles);
std::string qrcInputs;
const char* qrcInputsSep = "";

File diff suppressed because it is too large Load Diff

View File

@ -132,15 +132,11 @@ public:
void AddPostBuildCommand(cmCustomCommand const &cmd)
{this->PostBuildCommands.push_back(cmd);}
void Compute();
/**
* Get the list of the source files used by this target
*/
void GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config) const;
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
/**
* Add sources to the target.
*/
@ -233,54 +229,16 @@ public:
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
/** The link interface specifies transitive library dependencies and
other information needed by targets that link to this target. */
struct LinkInterfaceLibraries
{
// Libraries listed in the interface.
std::vector<cmLinkItem> Libraries;
};
struct LinkInterface: public LinkInterfaceLibraries
{
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
// Shared library dependencies needed for linking on some platforms.
std::vector<cmLinkItem> SharedDeps;
// Number of repetitions of a strongly connected component of two
// or more static libraries.
int Multiplicity;
// Libraries listed for other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
bool ImplementationIsInterface;
LinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
};
/** Get the link interface for the given configuration. Returns 0
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
LinkInterfaceLibraries const*
GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget,
bool usage_requirements_only) const;
struct LinkImplementation: public cmLinkImplementationLibraries
{
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
LinkImplementation const*
GetLinkImplementation(const std::string& config) const;
cmLinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const;
void ComputeLinkImplementationLibraries(const std::string& config,
cmOptionalLinkImplementation& impl,
cmTarget const* head) const;
cmOptionalLinkImplementation&
GetLinkImplMap(std::string const& config) const;
cmTarget const* FindTargetToLink(std::string const& name) const;
/** Strip off leading and trailing whitespace from an item named in
@ -331,7 +289,6 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const;
// Get the properties
@ -346,18 +303,6 @@ public:
If no macro should be defined null is returned. */
const char* GetExportMacro() const;
void GetCompileDefinitions(std::vector<std::string> &result,
const std::string& config,
const std::string& language) const;
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
// when source file properties are changed and we do not have enough
// information to forward these property changes to the targets
// until we have per-target object file properties.
void GetLanguages(std::set<std::string>& languages,
std::string const& config) const;
/** Return whether this target is an executable with symbol exports
enabled. */
bool IsExecutableWithExports() const;
@ -401,9 +346,6 @@ public:
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
std::vector<std::string> GetIncludeDirectories(
const std::string& config,
const std::string& language) const;
void InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before = false);
@ -415,12 +357,6 @@ public:
void AppendBuildInterfaceIncludes();
void GetCompileOptions(std::vector<std::string> &result,
const std::string& config,
const std::string& language) const;
void GetCompileFeatures(std::vector<std::string> &features,
const std::string& config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
@ -439,6 +375,18 @@ public:
return this->MaxLanguageStandards;
}
cmStringRange GetIncludeDirectoriesEntries() const;
cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
cmStringRange GetCompileOptionsEntries() const;
cmBacktraceRange GetCompileOptionsBacktraces() const;
cmStringRange GetCompileFeaturesEntries() const;
cmBacktraceRange GetCompileFeaturesBacktraces() const;
cmStringRange GetCompileDefinitionsEntries() const;
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
#if defined(_WIN32) && !defined(__CYGWIN__)
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
return this->LinkLibrariesForVS6;}
@ -553,11 +501,7 @@ private:
bool IsApple;
bool IsImportedTarget;
bool BuildInterfaceIncludesAppended;
mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileDefinitionsDone;
mutable bool DebugSourcesDone;
mutable bool DebugCompileFeaturesDone;
mutable bool LinkImplementationLanguageIsContextDependent;
#if defined(_WIN32) && !defined(__CYGWIN__)
bool LinkLibrariesForVS6Analyzed;
@ -591,23 +535,10 @@ private:
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
LinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head,
bool usage_requirements_only) const;
cmLinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const;
void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget,
bool usage_requirements_only,
std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition) const;
void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const;
std::string ProcessSourceItemCMP0049(const std::string& s);
void ClearLinkMaps();

View File

@ -965,7 +965,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceGroup> sourceGroups =
this->Makefile->GetSourceGroups();
std::vector<cmSourceFile*> classes;
if (!this->Target->GetConfigCommonSourceFiles(classes))
if (!this->GeneratorTarget->GetConfigCommonSourceFiles(classes))
{
return;
}
@ -1934,7 +1934,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str());
std::vector<std::string> targetDefines;
this->Target->GetCompileDefinitions(targetDefines,
this->GeneratorTarget->GetCompileDefinitions(targetDefines,
configName.c_str(), "CXX");
clOptions.AddDefines(targetDefines);
if(this->MSTools)