diff options
author | Brad King <brad.king@kitware.com> | 2013-12-19 15:13:18 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-12-19 15:13:18 (GMT) |
commit | 2e075b48e876d0f9b3f90ae225a33359e2d3342f (patch) | |
tree | 58519e39b8faa1b67ff2ceb3f470b2f494b4816a | |
parent | cc054e94f81f028c5990729d7bffb5488547bcbe (diff) | |
parent | c62cd3e2aeb9ed7e3021bd9e5863294fd0441790 (diff) | |
download | CMake-2e075b48e876d0f9b3f90ae225a33359e2d3342f.zip CMake-2e075b48e876d0f9b3f90ae225a33359e2d3342f.tar.gz CMake-2e075b48e876d0f9b3f90ae225a33359e2d3342f.tar.bz2 |
Merge topic 'constify'
c62cd3e Constify autogen handling.
035b690 Autogen: Split AutoRcc handling into two methods
2fcafbf cmLocalGenerator: Constify target definitions access
a54eedd Constify cmGeneratorTarget access.
9edee62 Constify handling of link targets.
ef25ba8 Constify handling of target dependencies.
36 files changed, 226 insertions, 180 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 31cc393..1be5980 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -619,19 +619,19 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, } //---------------------------------------------------------------------------- -cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index, +cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, const char* name) { // Look for a target in the scope of the depender. cmMakefile* mf = this->Makefile; if(depender_index >= 0) { - if(cmTarget* depender = this->EntryList[depender_index].Target) + if(cmTarget const* depender = this->EntryList[depender_index].Target) { mf = depender->GetMakefile(); } } - cmTarget* tgt = mf->FindTargetToUse(name); + cmTarget const* tgt = mf->FindTargetToUse(name); // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -950,7 +950,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) int count = 2; for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - if(cmTarget* target = this->EntryList[*ni].Target) + if(cmTarget const* target = this->EntryList[*ni].Target) { if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(this->Config, this->HeadTarget)) @@ -997,7 +997,8 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - if(cmTarget* tgt = this->FindTargetToLink(depender_index, item.c_str())) + if(cmTarget const* tgt + = this->FindTargetToLink(depender_index, item.c_str())) { if(!tgt->IsImported()) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index b86c9b2..cf227fb 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -40,7 +40,7 @@ public: struct LinkEntry { std::string Item; - cmTarget* Target; + cmTarget const* Target; bool IsSharedDep; bool IsFlag; LinkEntry(): Item(), Target(0), IsSharedDep(false), IsFlag(false) {} @@ -53,7 +53,7 @@ public: EntryVector const& Compute(); void SetOldLinkDirMode(bool b); - std::set<cmTarget*> const& GetOldWrongConfigItems() const + std::set<cmTarget const*> const& GetOldWrongConfigItems() const { return this->OldWrongConfigItems; } private: @@ -83,7 +83,7 @@ private: void AddDirectLinkEntries(); void AddLinkEntries(int depender_index, std::vector<std::string> const& libs); - cmTarget* FindTargetToLink(int depender_index, const char* name); + cmTarget const* FindTargetToLink(int depender_index, const char* name); // One entry for each unique item. std::vector<LinkEntry> EntryList; @@ -164,7 +164,7 @@ private: // Compatibility help. bool OldLinkDirMode; void CheckWrongConfigItem(int depender_index, std::string const& item); - std::set<cmTarget*> OldWrongConfigItems; + std::set<cmTarget const*> OldWrongConfigItems; }; #endif diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 0ef3d2e..f3bdddd 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -477,7 +477,7 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths() } //---------------------------------------------------------------------------- -std::set<cmTarget*> const& +std::set<cmTarget const*> const& cmComputeLinkInformation::GetSharedLibrariesLinked() { return this->SharedLibrariesLinked; @@ -542,11 +542,11 @@ bool cmComputeLinkInformation::Compute() // For CMake 2.4 bug-compatibility we need to consider the output // directories of targets linked in another configuration as link // directories. - std::set<cmTarget*> const& wrongItems = cld.GetOldWrongConfigItems(); - for(std::set<cmTarget*>::const_iterator i = wrongItems.begin(); + std::set<cmTarget const*> const& wrongItems = cld.GetOldWrongConfigItems(); + for(std::set<cmTarget const*>::const_iterator i = wrongItems.begin(); i != wrongItems.end(); ++i) { - cmTarget* tgt = *i; + cmTarget const* tgt = *i; bool implib = (this->UseImportLibrary && (tgt->GetType() == cmTarget::SHARED_LIBRARY)); @@ -620,7 +620,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) } //---------------------------------------------------------------------------- -void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) +void cmComputeLinkInformation::AddItem(std::string const& item, + cmTarget const* tgt) { // Compute the proper name to use to link this library. const char* config = this->Config; @@ -700,7 +701,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt) //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, - cmTarget* tgt) + cmTarget const* tgt) { // If dropping shared library dependencies, ignore them. if(this->SharedDependencyMode == SharedDepModeNone) @@ -1062,7 +1063,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt) //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddTargetItem(std::string const& item, - cmTarget* target) + cmTarget const* target) { // This is called to handle a link item that is a full path to a target. // If the target is not a static library make sure the link type is @@ -1744,7 +1745,7 @@ cmComputeLinkInformation::GetRuntimeSearchPath() //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, - cmTarget* target) + cmTarget const* target) { // Ignore targets on Apple where install_name is not @rpath. // The dependenty library can be found with other means such as diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 1da5495..356e6ed 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -39,11 +39,11 @@ public: Item(): Value(), IsPath(true), Target(0) {} Item(Item const& item): Value(item.Value), IsPath(item.IsPath), Target(item.Target) {} - Item(std::string const& v, bool p, cmTarget* target = 0): + Item(std::string const& v, bool p, cmTarget const* target = 0): Value(v), IsPath(p), Target(target) {} std::string Value; bool IsPath; - cmTarget* Target; + cmTarget const* Target; }; typedef std::vector<Item> ItemVector; ItemVector const& GetItems(); @@ -57,13 +57,13 @@ public: void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install); std::string GetRPathString(bool for_install); std::string GetChrpathString(); - std::set<cmTarget*> const& GetSharedLibrariesLinked(); + std::set<cmTarget const*> const& GetSharedLibrariesLinked(); std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; } std::string GetRPathLinkString(); private: - void AddItem(std::string const& item, cmTarget* tgt); - void AddSharedDepItem(std::string const& item, cmTarget* tgt); + void AddItem(std::string const& item, cmTarget const* tgt); + void AddSharedDepItem(std::string const& item, cmTarget const* tgt); // Output information. ItemVector Items; @@ -71,7 +71,7 @@ private: std::vector<std::string> Depends; std::vector<std::string> FrameworkPaths; std::vector<std::string> RuntimeSearchPath; - std::set<cmTarget*> SharedLibrariesLinked; + std::set<cmTarget const*> SharedLibrariesLinked; // Context information. cmTarget const* Target; @@ -139,7 +139,7 @@ private: std::string NoCaseExpression(const char* str); // Handling of link items. - void AddTargetItem(std::string const& item, cmTarget* target); + void AddTargetItem(std::string const& item, cmTarget const* target); void AddFullItem(std::string const& item); bool CheckImplicitDirItem(std::string const& item); void AddUserItem(std::string const& item, bool pathNotKnown); @@ -179,7 +179,8 @@ private: // Runtime path computation. cmOrderDirectories* OrderRuntimeSearchPath; - void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target); + void AddLibraryRuntimeInfo(std::string const& fullPath, + cmTarget const* target); void AddLibraryRuntimeInfo(std::string const& fullPath); // Dependent library path computation. diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 02fd173..73a8e27 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -143,12 +143,13 @@ bool cmComputeTargetDepends::Compute() //---------------------------------------------------------------------------- void -cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t, +cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps) { // Lookup the index for this target. All targets should be known by // this point. - std::map<cmTarget*, int>::const_iterator tii = this->TargetIndex.find(t); + std::map<cmTarget const*, int>::const_iterator tii + = this->TargetIndex.find(t); assert(tii != this->TargetIndex.end()); int i = tii->second; @@ -156,7 +157,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t, EdgeList const& nl = this->FinalGraph[i]; for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - cmTarget* dep = this->Targets[*ni]; + cmTarget const* dep = this->Targets[*ni]; cmTargetDependSet::iterator di = deps.insert(dep).first; di->SetType(ni->IsStrong()); } @@ -170,10 +171,11 @@ void cmComputeTargetDepends::CollectTargets() this->GlobalGenerator->GetLocalGenerators(); for(unsigned int i = 0; i < lgens.size(); ++i) { - cmTargets& targets = lgens[i]->GetMakefile()->GetTargets(); - for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) + const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets(); + for(cmTargets::const_iterator ti = targets.begin(); + ti != targets.end(); ++ti) { - cmTarget* target = &ti->second; + cmTarget const* target = &ti->second; int index = static_cast<int>(this->Targets.size()); this->TargetIndex[target] = index; this->Targets.push_back(target); @@ -198,7 +200,7 @@ void cmComputeTargetDepends::CollectDepends() void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. - cmTarget* depender = this->Targets[depender_index]; + cmTarget const* depender = this->Targets[depender_index]; if (depender->GetType() == cmTarget::INTERFACE_LIBRARY) { return; @@ -271,11 +273,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - cmTarget* dependee, + cmTarget const* dependee, const char *config, std::set<cmStdString> &emitted) { - cmTarget* depender = this->Targets[depender_index]; + cmTarget const* depender = this->Targets[depender_index]; if(cmTarget::LinkInterface const* iface = dependee->GetLinkInterface(config, depender)) { @@ -300,8 +302,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, bool linking, std::set<cmStdString> &emitted) { - cmTarget* depender = this->Targets[depender_index]; - cmTarget* dependee = + cmTarget const* depender = this->Targets[depender_index]; + cmTarget const* dependee = depender->GetMakefile()->FindTargetToUse(dependee_name); // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -335,10 +337,10 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, bool linking) { // Get the depender. - cmTarget* depender = this->Targets[depender_index]; + cmTarget const* depender = this->Targets[depender_index]; // Check the target's makefile first. - cmTarget* dependee = + cmTarget const* dependee = depender->GetMakefile()->FindTargetToUse(dependee_name); // Skip targets that will not really be linked. This is probably a @@ -359,7 +361,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, - cmTarget* dependee, + cmTarget const* dependee, bool linking) { if(dependee->IsImported()) @@ -369,7 +371,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, for(std::set<cmStdString>::const_iterator i = utils.begin(); i != utils.end(); ++i) { - if(cmTarget* transitive_dependee = + if(cmTarget const* transitive_dependee = dependee->GetMakefile()->FindTargetToUse(i->c_str())) { this->AddTargetDepend(depender_index, transitive_dependee, false); @@ -380,7 +382,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, { // Lookup the index for this target. All targets should be known by // this point. - std::map<cmTarget*, int>::const_iterator tii = + std::map<cmTarget const*, int>::const_iterator tii = this->TargetIndex.find(dependee); assert(tii != this->TargetIndex.end()); int dependee_index = tii->second; @@ -400,13 +402,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name) for(int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; - cmTarget* depender = this->Targets[depender_index]; + cmTarget const* depender = this->Targets[depender_index]; fprintf(stderr, "target %d is [%s]\n", depender_index, depender->GetName()); for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; - cmTarget* dependee = this->Targets[dependee_index]; + cmTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, dependee->GetName(), ni->IsStrong()? "strong" : "weak"); } @@ -493,7 +495,7 @@ cmComputeTargetDepends { // Get the depender. int i = *ci; - cmTarget* depender = this->Targets[i]; + cmTarget const* depender = this->Targets[i]; // Describe the depender. e << " \"" << depender->GetName() << "\" of type " @@ -506,7 +508,7 @@ cmComputeTargetDepends int j = *ni; if(cmap[j] == c) { - cmTarget* dependee = this->Targets[j]; + cmTarget const* dependee = this->Targets[j]; e << " depends on \"" << dependee->GetName() << "\"" << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n"; } diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index d6131cf..6cd6da0 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -38,19 +38,21 @@ public: bool Compute(); - std::vector<cmTarget*> const& GetTargets() const { return this->Targets; } - void GetTargetDirectDepends(cmTarget* t, cmTargetDependSet& deps); + std::vector<cmTarget const*> const& + GetTargets() const { return this->Targets; } + void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps); private: void CollectTargets(); void CollectDepends(); void CollectTargetDepends(int depender_index); void AddTargetDepend(int depender_index, const char* dependee_name, bool linking); - void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking); + void AddTargetDepend(int depender_index, cmTarget const* dependee, + bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, const char* dependee_name, bool linking, std::set<cmStdString> &emitted); - void AddInterfaceDepends(int depender_index, cmTarget* dependee, + void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, std::set<cmStdString> &emitted); cmGlobalGenerator* GlobalGenerator; @@ -58,8 +60,8 @@ private: bool NoCycles; // Collect all targets. - std::vector<cmTarget*> Targets; - std::map<cmTarget*, int> TargetIndex; + std::vector<cmTarget const*> Targets; + std::map<cmTarget const*, int> TargetIndex; // Represent the target dependency graph. The entry at each // top-level index corresponds to a depender whose dependencies are diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index f8b4e28..2a87e4f 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -402,7 +402,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, //---------------------------------------------------------------------------- -void getPropertyContents(cmTarget *tgt, const char *prop, +void getPropertyContents(cmTarget const* tgt, const char *prop, std::set<std::string> &ifaceProperties) { const char *p = tgt->GetProperty(prop); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6aff5f0..8b760f1 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -104,7 +104,7 @@ struct cmStrictTargetComparison { bool operator()(cmTarget const* t1, cmTarget const* t2) const; }; -typedef std::map<cmTarget*, +typedef std::map<cmTarget const*, cmGeneratorTarget*, cmStrictTargetComparison> cmGeneratorTargetsType; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e6f3d94..e4a9246 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -950,7 +950,7 @@ void cmGlobalGenerator::ClearEnabledLanguages() } bool cmGlobalGenerator::IsDependedOn(const char* project, - cmTarget* targetIn) + cmTarget const* targetIn) { // Get all local gens for this project std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project]; @@ -1214,8 +1214,8 @@ bool cmGlobalGenerator::ComputeTargetDepends() { return false; } - std::vector<cmTarget*> const& targets = ctd.GetTargets(); - for(std::vector<cmTarget*>::const_iterator ti = targets.begin(); + std::vector<cmTarget const*> const& targets = ctd.GetTargets(); + for(std::vector<cmTarget const*>::const_iterator ti = targets.begin(); ti != targets.end(); ++ti) { ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]); @@ -1432,7 +1432,8 @@ void cmGlobalGenerator::ClearGeneratorMembers() } //---------------------------------------------------------------------------- -cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const +cmGeneratorTarget* +cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const { cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) @@ -1954,7 +1955,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() clg = clg->GetParent()) { // This local generator includes the target. - std::set<cmTarget*>& targetSet = + std::set<cmTarget const*>& targetSet = this->LocalGeneratorToTargetMap[clg]; targetSet.insert(&target); @@ -1965,7 +1966,8 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() for(TargetDependSet::const_iterator ti = tgtdeps.begin(); ti != tgtdeps.end(); ++ti) { - targetSet.insert(*ti); + cmTarget const* ttt = *ti; + targetSet.insert(ttt); } } } @@ -2478,7 +2480,7 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*, //---------------------------------------------------------------------------- cmGlobalGenerator::TargetDependSet const& -cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target) +cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target) { return this->TargetDependencies[&target]; } @@ -2600,7 +2602,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddTargetDepends(cmTarget* target, +void cmGlobalGenerator::AddTargetDepends(cmTarget const* target, TargetDependSet& projectTargets) { // add the target itself @@ -2611,7 +2613,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget* target, TargetDependSet const& ts = this->GetTargetDirectDepends(*target); for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i) { - cmTarget* dtarget = *i; + cmTarget const* dtarget = *i; this->AddTargetDepends(dtarget, projectTargets); } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index eb720a8..f60d24d 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -218,7 +218,7 @@ public: /** If check to see if the target is linked to by any other target in the project */ - bool IsDependedOn(const char* project, cmTarget* target); + bool IsDependedOn(const char* project, cmTarget const* target); ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const char* start_dir); @@ -266,10 +266,10 @@ public: // what targets does the specified target depend on directly // via a target_link_libraries or add_dependencies - TargetDependSet const& GetTargetDirectDepends(cmTarget & target); + TargetDependSet const& GetTargetDirectDepends(cmTarget const& target); /** Get per-target generator information. */ - cmGeneratorTarget* GetGeneratorTarget(cmTarget*) const; + cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap() const {return this->ProjectMap;} @@ -323,7 +323,8 @@ protected: TargetDependSet& originalTargets, cmLocalGenerator* root, GeneratorVector const&); virtual bool IsRootOnlyTarget(cmTarget* target); - void AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets); + void AddTargetDepends(cmTarget const* target, + TargetDependSet& projectTargets); void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); @@ -333,7 +334,8 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS(); bool CheckTargets(); - typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > AutogensType; + typedef std::vector<std::pair<cmQtAutoGenerators, + cmTarget const*> > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); std::string SelectMakeProgram(const char* makeProgram, @@ -362,7 +364,8 @@ protected: cmLocalGenerator* CurrentLocalGenerator; // map from project name to vector of local generators in that project std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap; - std::map<cmLocalGenerator*, std::set<cmTarget *> > LocalGeneratorToTargetMap; + std::map<cmLocalGenerator*, std::set<cmTarget const*> > + LocalGeneratorToTargetMap; // Set of named installation components requested by the project. std::set<cmStdString> InstallComponents; @@ -420,7 +423,7 @@ private: std::vector<std::string> FilesReplacedDuringGenerate; // Store computed inter-target dependencies. - typedef std::map<cmTarget *, TargetDependSet> TargetDependMap; + typedef std::map<cmTarget const*, TargetDependSet> TargetDependMap; TargetDependMap TargetDependencies; // Per-target generator information. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 77571b2..4b92058 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -830,7 +830,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() void cmGlobalNinjaGenerator -::AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs) +::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs) { const char* configName = target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE"); @@ -879,7 +879,7 @@ cmGlobalNinjaGenerator void cmGlobalNinjaGenerator -::AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs) +::AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs) { if (target->GetType() == cmTarget::GLOBAL_TARGET) { // Global targets only depend on other utilities, which may not appear in diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 4fd0d5c..de38923 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -283,8 +283,8 @@ public: ASD.insert(deps.begin(), deps.end()); } - void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs); - void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs); + void AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs); + void AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs); void AddDependencyToAll(cmTarget* target); void AddDependencyToAll(const std::string& input); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 52465dc..622a7c5 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -841,7 +841,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // - std::set<cmTarget *> emitted; + std::set<cmTarget const*> emitted; progCmd << " " << this->CountProgressMarksInTarget(t->second->Target, emitted); commands.push_back(progCmd.str()); @@ -919,8 +919,8 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- size_t cmGlobalUnixMakefileGenerator3 -::CountProgressMarksInTarget(cmTarget* target, - std::set<cmTarget*>& emitted) +::CountProgressMarksInTarget(cmTarget const* target, + std::set<cmTarget const*>& emitted) { size_t count = 0; if(emitted.insert(target).second) @@ -946,9 +946,10 @@ cmGlobalUnixMakefileGenerator3 ::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg) { size_t count = 0; - std::set<cmTarget*> emitted; - std::set<cmTarget*> const& targets = this->LocalGeneratorToTargetMap[lg]; - for(std::set<cmTarget*>::const_iterator t = targets.begin(); + std::set<cmTarget const*> emitted; + std::set<cmTarget const*> const& targets + = this->LocalGeneratorToTargetMap[lg]; + for(std::set<cmTarget const*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { count += this->CountProgressMarksInTarget(*t, emitted); @@ -969,7 +970,7 @@ cmGlobalUnixMakefileGenerator3::RecordTargetProgress( //---------------------------------------------------------------------------- bool cmGlobalUnixMakefileGenerator3::ProgressMapCompare -::operator()(cmTarget* l, cmTarget* r) const +::operator()(cmTarget const* l, cmTarget const* r) const { // Order by target name. if(int c = strcmp(l->GetName(), r->GetName())) diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 284f5d1..986d1d7 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -181,13 +181,14 @@ protected: std::vector<unsigned long> Marks; void WriteProgressVariables(unsigned long total, unsigned long& current); }; - struct ProgressMapCompare { bool operator()(cmTarget*,cmTarget*) const; }; - typedef std::map<cmTarget*, TargetProgress, + struct ProgressMapCompare { bool operator()(cmTarget const*, + cmTarget const*) const; }; + typedef std::map<cmTarget const*, TargetProgress, ProgressMapCompare> ProgressMapType; ProgressMapType ProgressMap; - size_t CountProgressMarksInTarget(cmTarget* target, - std::set<cmTarget*>& emitted); + size_t CountProgressMarksInTarget(cmTarget const* target, + std::set<cmTarget const*>& emitted); size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg); cmGeneratedFileStream *CommandDatabase; diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 614a79a..38c47ef 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -205,7 +205,7 @@ void cmGlobalVisualStudio6Generator tt = orderedProjectTargets.begin(); tt != orderedProjectTargets.end(); ++tt) { - cmTarget* target = *tt; + cmTarget const* target = *tt; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -271,7 +271,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, - cmTarget& target) + cmTarget const& target) { fout << "#########################################################" "######################\n\n"; @@ -364,7 +364,7 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout) //---------------------------------------------------------------------------- std::string -cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target) +cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget const* target) { std::string pname = target->GetName(); pname += "_UTILITY"; diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index cb6cb8b..5521410 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -99,12 +99,12 @@ private: void WriteDSWFile(std::ostream& fout); void WriteDSWHeader(std::ostream& fout); void WriteProject(std::ostream& fout, - const char* name, const char* path, cmTarget &t); + const char* name, const char* path, cmTarget const& t); void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const std::set<cmStdString>& dependencies); void WriteDSWFooter(std::ostream& fout); - virtual std::string WriteUtilityDepend(cmTarget* target); + virtual std::string WriteUtilityDepend(cmTarget const* target); std::string MSDevCommand; bool MSDevCommandInitialized; std::string const& GetMSDevCommand(); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 61d3c4c..6cfad25 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -157,7 +157,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, - cmTarget& t) + cmTarget const& t) { // check to see if this is a fortran build const char* ext = ".vcproj"; @@ -209,7 +209,7 @@ void cmGlobalVisualStudio71Generator ::WriteProjectDepends(std::ostream& fout, const char*, - const char*, cmTarget& target) + const char*, cmTarget const& target) { VSDependSet const& depends = this->VSTargetDepends[&target]; for(VSDependSet::const_iterator di = depends.begin(); diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index e136db7..04e3a55 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -59,9 +59,11 @@ protected: std::vector<cmLocalGenerator*>& generators); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, cmTarget &t); + const char* name, const char* path, + cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, cmTarget &t); + const char* name, const char* path, + cmTarget const& t); virtual void WriteProjectConfigurations( std::ostream& fout, const char* name, cmTarget::TargetType type, const std::set<std::string>& configsPartOfDefaultBuild, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a217d8c..1899b40 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -335,7 +335,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = *tt; + cmTarget const* target = *tt; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -376,7 +376,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = *tt; + cmTarget const* target = *tt; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -470,7 +470,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { - cmTarget* target = *tt; + cmTarget const* target = *tt; if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; @@ -619,7 +619,7 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* dspname, - const char* dir, cmTarget& target) + const char* dir, cmTarget const& target) { // check to see if this is a fortran build const char* ext = ".vcproj"; @@ -659,7 +659,7 @@ void cmGlobalVisualStudio7Generator ::WriteProjectDepends(std::ostream& fout, const char* dspname, - const char*, cmTarget& target) + const char*, cmTarget const& target) { int depcount = 0; std::string dspguid = this->GetGUID(dspname); @@ -819,7 +819,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- std::string -cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget* target) +cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) { std::string pname = target->GetName(); pname += "_UTILITY"; @@ -940,7 +940,7 @@ cmGlobalVisualStudio7Generator std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, - cmTarget* target) + cmTarget const* target) { std::set<std::string> activeConfigs; // if it is a utilitiy target then only make it part of the diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 59e74ba..611422a 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -121,9 +121,11 @@ protected: virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, cmTarget &t); + const char* name, const char* path, + cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, cmTarget &t); + const char* name, const char* path, + cmTarget const&t); virtual void WriteProjectConfigurations( std::ostream& fout, const char* name, cmTarget::TargetType type, const std::set<std::string>& configsPartOfDefaultBuild, @@ -132,7 +134,7 @@ protected: cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); - virtual std::string WriteUtilityDepend(cmTarget* target); + virtual std::string WriteUtilityDepend(cmTarget const* target); virtual void WriteTargetsToSolution( std::ostream& fout, @@ -158,7 +160,7 @@ protected: std::string ConvertToSolutionPath(const char* path); std::set<std::string> IsPartOfDefaultBuild(const char* project, - cmTarget* target); + cmTarget const* target); std::vector<std::string> Configurations; std::map<cmStdString, cmStdString> GUIDMap; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e4ce13f..12c240b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -415,7 +415,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::WriteProjectDepends( - std::ostream& fout, const char*, const char*, cmTarget& t) + std::ostream& fout, const char*, const char*, cmTarget const& t) { TargetDependSet const& unordered = this->GetTargetDirectDepends(t); OrderedTargetDependSet depends(unordered); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index ad01a24..5b952c4 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -84,7 +84,7 @@ protected: const char* platformMapping = NULL); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, - const char* path, cmTarget &t); + const char* path, cmTarget const& t); std::string Name; std::string WindowsCEVersion; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 6c782e4..93a597c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -315,7 +315,7 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget* target, +void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target, TargetSet& linked) { if(linked.insert(target).second) @@ -348,7 +348,7 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target) //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::FollowLinkDepends( - cmTarget* target, std::set<cmTarget*>& linked) + cmTarget const* target, std::set<cmTarget const*>& linked) { if(target->GetType() == cmTarget::INTERFACE_LIBRARY) { @@ -397,7 +397,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() } //---------------------------------------------------------------------------- -static bool VSLinkable(cmTarget* t) +static bool VSLinkable(cmTarget const* t) { return t->IsLinkable() || t->GetType() == cmTarget::OBJECT_LIBRARY; } @@ -439,7 +439,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) // Collect implicit link dependencies (target_link_libraries). // Static libraries cannot depend on their link implementation // due to behavior (2), but they do not really need to. - std::set<cmTarget*> linkDepends; + std::set<cmTarget const*> linkDepends; if(target.GetType() != cmTarget::STATIC_LIBRARY) { for(TargetDependSet::const_iterator di = depends.begin(); @@ -454,7 +454,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) } // Collect explicit util dependencies (add_dependencies). - std::set<cmTarget*> utilDepends; + std::set<cmTarget const*> utilDepends; for(TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { @@ -474,18 +474,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) } // Emit link dependencies. - for(std::set<cmTarget*>::iterator di = linkDepends.begin(); + for(std::set<cmTarget const*>::iterator di = linkDepends.begin(); di != linkDepends.end(); ++di) { - cmTarget* dep = *di; + cmTarget const* dep = *di; vsTargetDepend.insert(dep->GetName()); } // Emit util dependencies. Possibly use intermediate targets. - for(std::set<cmTarget*>::iterator di = utilDepends.begin(); + for(std::set<cmTarget const*>::iterator di = utilDepends.begin(); di != utilDepends.end(); ++di) { - cmTarget* dep = *di; + cmTarget const* dep = *di; if(allowLinkable || !VSLinkable(dep) || linked.count(dep)) { // Direct dependency allowed. @@ -523,7 +523,8 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) } //---------------------------------------------------------------------------- -std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target) +std::string +cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target) { UtilityDependsMap::iterator i = this->UtilityDepends.find(target); if(i == this->UtilityDepends.end()) @@ -845,7 +846,8 @@ void RegisterVisualStudioMacros(const std::string& macrosFile, } } } -bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget& target) +bool +cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) { // check to see if this is a fortran build std::set<cmStdString> languages; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index da2d021..54e3c28 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -60,7 +60,7 @@ public: const char* vsSolutionFile = 0); // return true if target is fortran only - bool TargetIsFortranOnly(cmTarget& t); + bool TargetIsFortranOnly(cmTarget const& t); /** Get the top-level registry key for this VS version. */ std::string GetRegistryBase(); @@ -75,7 +75,7 @@ public: /** Return true if building for Windows CE */ virtual bool TargetsWindowsCE() const { return false; } - class TargetSet: public std::set<cmTarget*> {}; + class TargetSet: public std::set<cmTarget const*> {}; struct TargetCompare { bool operator()(cmTarget const* l, cmTarget const* r) const; @@ -96,15 +96,15 @@ protected: virtual bool ComputeTargetDepends(); class VSDependSet: public std::set<cmStdString> {}; - class VSDependMap: public std::map<cmTarget*, VSDependSet> {}; + class VSDependMap: public std::map<cmTarget const*, VSDependSet> {}; VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmTarget&); bool CheckTargetLinks(cmTarget& target, const char* name); std::string GetUtilityForTarget(cmTarget& target, const char*); - virtual std::string WriteUtilityDepend(cmTarget*) = 0; - std::string GetUtilityDepend(cmTarget* target); - typedef std::map<cmTarget*, cmStdString> UtilityDependsMap; + virtual std::string WriteUtilityDepend(cmTarget const*) = 0; + std::string GetUtilityDepend(cmTarget const* target); + typedef std::map<cmTarget const*, cmStdString> UtilityDependsMap; UtilityDependsMap UtilityDepends; const char* AdditionalPlatformDefinition; @@ -113,11 +113,12 @@ private: void PrintCompilerAdvice(std::ostream&, std::string, const char*) {} void ComputeTargetObjects(cmGeneratorTarget* gt) const; - void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked); + void FollowLinkDepends(cmTarget const* target, + std::set<cmTarget const*>& linked); class TargetSetMap: public std::map<cmTarget*, TargetSet> {}; TargetSetMap TargetLinkClosure; - void FillLinkClosure(cmTarget* target, TargetSet& linked); + void FillLinkClosure(cmTarget const* target, TargetSet& linked); TargetSet const& GetTargetLinkClosure(cmTarget* target); }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 215d483..b5a46d0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2622,7 +2622,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, } //---------------------------------------------------------------------------- -cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget* t) +cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) { if(!t) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e8cbd14..6281c3b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -125,7 +125,7 @@ private: multipleOutputPairs ); - cmXCodeObject* FindXCodeTarget(cmTarget*); + cmXCodeObject* FindXCodeTarget(cmTarget const*); std::string GetOrCreateId(const char* name, const char* id); // create cmXCodeObject from these functions so that memory can be managed diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 7b9109e..68f45a6 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -328,9 +328,10 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const } //---------------------------------------------------------------------------- -std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target, - const char* config, - NameType nameType) +std::string +cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, + const char* config, + NameType nameType) { std::string fname; // Compute the name of the library. @@ -515,11 +516,12 @@ cmInstallTargetGenerator std::map<cmStdString, cmStdString> install_name_remap; if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) { - std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked(); - for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin(); + std::set<cmTarget const*> const& sharedLibs + = cli->GetSharedLibrariesLinked(); + for(std::set<cmTarget const*>::const_iterator j = sharedLibs.begin(); j != sharedLibs.end(); ++j) { - cmTarget* tgt = *j; + cmTarget const* tgt = *j; // The install_name of an imported target does not change. if(tgt->IsImported()) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 8cf72f9..18c3957 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -53,7 +53,8 @@ public: NameReal }; - static std::string GetInstallFilename(cmTarget*target, const char* config, + static std::string GetInstallFilename(cmTarget const* target, + const char* config, NameType nameType = NameNormal); cmTarget* GetTarget() const { return this->Target; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c3c5299..68d603a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1386,7 +1386,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines, - cmTarget* target, + cmTarget const* target, const char* config) { std::vector<std::string> targetDefines; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9a89f0f..ad662d5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -224,8 +224,9 @@ public: bool stripImplicitInclDirs = true); void AddCompileOptions(std::string& flags, cmTarget* target, const char* lang, const char* config); - void AddCompileDefinitions(std::set<std::string>& defines, cmTarget* target, - const char* config); + void AddCompileDefinitions(std::set<std::string>& defines, + cmTarget const* target, + const char* config); /** Compute the language used to compile the given source file. */ const char* GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 835e3b4..2b4bb8a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -138,14 +138,14 @@ cmQtAutoGenerators::cmQtAutoGenerators() } } -static std::string getAutogenTargetName(cmTarget *target) +static std::string getAutogenTargetName(cmTarget const* target) { std::string autogenTargetName = target->GetName(); autogenTargetName += "_automoc"; return autogenTargetName; } -static std::string getAutogenTargetDir(cmTarget *target) +static std::string getAutogenTargetDir(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); std::string targetDir = makefile->GetCurrentOutputDirectory(); @@ -221,6 +221,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) if (target->GetPropertyAsBool("AUTORCC")) { toolNames.push_back("rcc"); + this->InitializeAutoRccTarget(target); } std::string tools = toolNames[0]; @@ -295,7 +296,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) return true; } -static void GetCompileDefinitionsAndDirectories(cmTarget *target, +static void GetCompileDefinitionsAndDirectories(cmTarget const* target, const char * config, std::string &incs, std::string &defs) @@ -303,10 +304,12 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target, cmMakefile* makefile = target->GetMakefile(); cmLocalGenerator* localGen = makefile->GetLocalGenerator(); std::vector<std::string> includeDirs; - cmGeneratorTarget gtgt(target); + cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator() + ->GetGlobalGenerator() + ->GetGeneratorTarget(target); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 - localGen->GetIncludeDirectories(includeDirs, >gt, "CXX", config, false); + localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); const char* sep = ""; incs = ""; for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin(); @@ -332,7 +335,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target, } } -void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target) +void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); @@ -435,7 +438,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target) } } -void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget* target, +void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const std::string &autogenTargetName, std::map<std::string, std::string> &configIncludes, std::map<std::string, std::string> &configDefines) @@ -614,7 +617,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -static void GetUicOpts(cmTarget *target, const char * config, +static void GetUicOpts(cmTarget const* target, const char * config, std::string &optString) { std::vector<std::string> opts; @@ -631,7 +634,7 @@ static void GetUicOpts(cmTarget *target, const char * config, } } -void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target, +void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::map<std::string, std::string> &configUicOptions) { cmMakefile *makefile = target->GetMakefile(); @@ -801,14 +804,47 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target) +void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target) +{ + cmMakefile *makefile = target->GetMakefile(); + + const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles(); + + for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); + fileIt != srcFiles.end(); + ++fileIt) + { + cmSourceFile* sf = *fileIt; + std::string ext = sf->GetExtension(); + if (ext == "qrc") + { + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath().c_str()); + bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")); + + if (!skip) + { + std::string basename = cmsys::SystemTools:: + GetFilenameWithoutLastExtension(absFile); + + std::string rcc_output_file = makefile->GetCurrentOutputDirectory(); + rcc_output_file += "/qrc_" + basename + ".cpp"; + makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", + rcc_output_file.c_str(), false); + cmSourceFile* rccCppSource + = makefile->GetOrCreateSource(rcc_output_file.c_str(), true); + target->AddSourceFile(rccCppSource); + } + } + } +} + +void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { std::string _rcc_files; const char* sepRccFiles = ""; cmMakefile *makefile = target->GetMakefile(); - std::vector<cmSourceFile*> newFiles; - const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles(); std::string rccFileFiles; @@ -841,17 +877,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target) _rcc_files += absFile; sepRccFiles = ";"; - std::string basename = cmsys::SystemTools:: - GetFilenameWithoutLastExtension(absFile); - - std::string rcc_output_file = makefile->GetCurrentOutputDirectory(); - rcc_output_file += "/qrc_" + basename + ".cpp"; - makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", - rcc_output_file.c_str(), false); - cmSourceFile* rccCppSource - = makefile->GetOrCreateSource(rcc_output_file.c_str(), true); - newFiles.push_back(rccCppSource); - if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS")) { std::vector<std::string> optsVec; @@ -880,13 +905,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target) } } - for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin(); - fileIt != newFiles.end(); - ++fileIt) - { - target->AddSourceFile(*fileIt); - } - makefile->AddDefinition("_rcc_files", cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str()); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index e877f7d..80123d8 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -24,16 +24,17 @@ public: bool Run(const char* targetDirectory, const char *config); bool InitializeAutogenTarget(cmTarget* target); - void SetupAutoGenerateTarget(cmTarget* target); + void SetupAutoGenerateTarget(cmTarget const* target); private: - void SetupAutoMocTarget(cmTarget* target, + void SetupAutoMocTarget(cmTarget const* target, const std::string &autogenTargetName, std::map<std::string, std::string> &configIncludes, std::map<std::string, std::string> &configDefines); - void SetupAutoUicTarget(cmTarget* target, + void SetupAutoUicTarget(cmTarget const* target, std::map<std::string, std::string> &configUicOptions); - void SetupAutoRccTarget(cmTarget* target); + void InitializeAutoRccTarget(cmTarget* target); + void SetupAutoRccTarget(cmTarget const* target); cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, const char* targetDirectory); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 51ee31a..a44cda1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -828,7 +828,8 @@ void cmTarget::GetDirectLinkLibraries(const char *config, //---------------------------------------------------------------------------- void cmTarget::GetInterfaceLinkLibraries(const char *config, - std::vector<std::string> &libs, cmTarget *head) const + std::vector<std::string> &libs, + cmTarget const* head) const { const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); if (prop) @@ -5770,7 +5771,8 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, //---------------------------------------------------------------------------- template<typename PropertyType> -void checkPropertyConsistency(cmTarget const* depender, cmTarget *dependee, +void checkPropertyConsistency(cmTarget const* depender, + cmTarget const* dependee, const char *propName, std::set<cmStdString> &emitted, const char *config, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3f5a5d1..bf4a8ef 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -187,7 +187,7 @@ public: cmTarget const* head) const; void GetInterfaceLinkLibraries(const char *config, std::vector<std::string> &, - cmTarget *head) const; + cmTarget const* head) const; /** Compute the link type to use for the given configuration. */ LinkLibraryType ComputeLinkType(const char* config) const; diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 258bacd..1feb072 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -20,17 +20,17 @@ class cmTarget; It may be marked as a 'link' or 'util' edge or both. */ class cmTargetDepend { - cmTarget* Target; + cmTarget const* Target; // The set order depends only on the Target, so we use // mutable members to acheive a map with set syntax. mutable bool Link; mutable bool Util; public: - cmTargetDepend(cmTarget* t): Target(t), Link(false), Util(false) {} - operator cmTarget*() const { return this->Target; } - cmTarget* operator->() const { return this->Target; } - cmTarget& operator*() const { return *this->Target; } + cmTargetDepend(cmTarget const* t): Target(t), Link(false), Util(false) {} + operator cmTarget const*() const { return this->Target; } + cmTarget const* operator->() const { return this->Target; } + cmTarget const& operator*() const { return *this->Target; } friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r) { return l.Target < r.Target; } void SetType(bool strong) const diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 10663b7..b9ae701 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1841,7 +1841,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() for( OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { - cmTarget* dt = *i; + cmTarget const* dt = *i; if(dt->GetType() == cmTarget::INTERFACE_LIBRARY) { continue; |