diff options
27 files changed, 217 insertions, 229 deletions
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 78a9485..de55cc4 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -91,7 +91,7 @@ void cmExportLibraryDependenciesCommand::FinalPass() cmTargets &tgts = gen->GetMakefile()->GetTargets(); std::vector<std::string> depends; const char *defType; - for(cmTargets::const_iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((l->second.GetType() != cmTarget::INSTALL_FILES) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f63fa99..dea33eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -531,9 +531,9 @@ void cmGlobalGenerator::Configure() { manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager(); m_LocalGenerators[i]->ConfigureFinalPass(); - cmTargets const& targets = + cmTargets & targets = m_LocalGenerators[i]->GetMakefile()->GetTargets(); - for (cmTargets::const_iterator l = targets.begin(); + for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) { cmTarget::LinkLibraries libs = l->second.GetLinkLibraries(); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 7ed9dc6..012262d 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -78,7 +78,7 @@ void cmGlobalKdevelopGenerator::Generate() //run from kdevelop for now just pick the first executable found std::string executable; cmTargets& targets=mf->GetTargets(); - for (cmTargets::const_iterator ti = targets.begin(); + for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ti++) { if (ti->second.GetType()==cmTarget::EXECUTABLE) @@ -134,7 +134,7 @@ bool cmGlobalKdevelopGenerator //get all sources cmTargets& targets=makefile->GetTargets(); - for (cmTargets::const_iterator ti = targets.begin(); + for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ti++) { const std::vector<cmSourceFile*>& sources=ti->second.GetSourceFiles(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 6ee17e0..d9927a3 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -467,7 +467,7 @@ cmGlobalUnixMakefileGenerator3 std::vector<std::string> all_tgts; // for all of out targets - for (cmTargets::const_iterator l = lg->GetMakefile()->GetTargets().begin(); + for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); l != lg->GetMakefile()->GetTargets().end(); l++) { if((l->second.GetType() == cmTarget::EXECUTABLE) || @@ -528,7 +528,7 @@ cmGlobalUnixMakefileGenerator3 std::vector<std::string> all_tgts; // for all of out targets - for (cmTargets::const_iterator l = lg->GetMakefile()->GetTargets().begin(); + for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); l != lg->GetMakefile()->GetTargets().end(); l++) { if((l->second.GetType() == cmTarget::EXECUTABLE) || @@ -597,7 +597,7 @@ cmGlobalUnixMakefileGenerator3 std::vector<std::string> all_tgts; // for all of out targets - for (cmTargets::const_iterator l = lg->GetMakefile()->GetTargets().begin(); + for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); l != lg->GetMakefile()->GetTargets().end(); l++) { if((l->second.GetType() == cmTarget::EXECUTABLE) || @@ -658,7 +658,7 @@ cmGlobalUnixMakefileGenerator3 std::vector<std::string> all_tgts; // for all of out targets - for (cmTargets::const_iterator l = lg->GetMakefile()->GetTargets().begin(); + for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); l != lg->GetMakefile()->GetTargets().end(); l++) { if((l->second.GetType() == cmTarget::EXECUTABLE) || @@ -713,8 +713,8 @@ cmGlobalUnixMakefileGenerator3 depends.push_back("cmake_check_build_system"); // for each target Generate the rule files for each target. - const cmTargets& targets = lg->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) + cmTargets& targets = lg->GetMakefile()->GetTargets(); + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { if((t->second.GetType() == cmTarget::EXECUTABLE) || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || @@ -767,9 +767,9 @@ cmGlobalUnixMakefileGenerator3 depends.push_back("cmake_check_build_system"); // for each target Generate the rule files for each target. - const cmTargets& targets = lg->GetMakefile()->GetTargets(); + cmTargets& targets = lg->GetMakefile()->GetTargets(); bool needRequiresStep = this->NeedRequiresStep(lg); - for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { if (((t->second.GetType() == cmTarget::EXECUTABLE) || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || @@ -870,7 +870,7 @@ cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3 ::AppendGlobalTargetDepends(std::vector<std::string>& depends, - const cmTarget& target) + cmTarget& target) { // Keep track of dependencies already listed. std::set<cmStdString> emitted; @@ -964,8 +964,8 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream) lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]); // for each target Generate the rule files for each target. - const cmTargets& targets = lg->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) + cmTargets& targets = lg->GetMakefile()->GetTargets(); + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { if((t->second.GetType() == cmTarget::EXECUTABLE) || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 2de97df..6fc4f5f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -106,7 +106,7 @@ protected: cmLocalUnixMakefileGenerator3 *lg); void AppendGlobalTargetDepends(std::vector<std::string>& depends, - const cmTarget& target); + cmTarget& target); void AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 79fd4fd..eed2e09 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -247,9 +247,8 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout, unsigned int j; for(j = 0; j < generators.size(); ++j) { - const cmTargets &atgts = - generators[j]->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator al = atgts.begin(); + cmTargets &atgts = generators[j]->GetMakefile()->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { if (al->second.IsInAll()) @@ -368,7 +367,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, - const cmTarget& target) + cmTarget& target) { fout << "#########################################################" "######################\n\n"; diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 0234ac7..0af3ae6 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -79,8 +79,7 @@ private: void WriteDSWFile(std::ostream& fout); void WriteDSWHeader(std::ostream& fout); void WriteProject(std::ostream& fout, - const char* name, const char* path, - const cmTarget &t); + const char* name, const char* path, cmTarget &t); void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const std::vector<std::string>& dependencies); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 455ae4a..bba2ae5 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -96,9 +96,8 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout, unsigned int j; for(j = 0; j < generators.size(); ++j) { - const cmTargets &atgts = - generators[j]->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator al = atgts.begin(); + cmTargets &atgts = generators[j]->GetMakefile()->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { if (al->second.IsInAll()) @@ -229,7 +228,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, - const cmTarget& t) + cmTarget& t) { std::string d = cmSystemTools::ConvertToOutputPath(dir); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" @@ -252,8 +251,7 @@ void cmGlobalVisualStudio71Generator ::WriteProjectDepends(std::ostream& fout, const char* dspname, - const char*, - const cmTarget& target) + const char*, cmTarget& target) { // insert Begin Project Dependency Project_Dep_Name project stuff here if (target.GetType() != cmTarget::STATIC_LIBRARY) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index a5a47a8..e1ff825 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -47,11 +47,9 @@ protected: cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, - const cmTarget &t); + const char* name, const char* path, cmTarget &t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, - const cmTarget &t); + const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const std::vector<std::string>& depends); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a604485..34ae9a2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -312,9 +312,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout, unsigned int j; for(j = 0; j < generators.size(); ++j) { - const cmTargets &atgts = - generators[j]->GetMakefile()->GetTargets(); - for(cmTargets::const_iterator al = atgts.begin(); + cmTargets &atgts = generators[j]->GetMakefile()->GetTargets(); + for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { if (al->second.IsInAll()) @@ -498,8 +497,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout, // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* dspname, - const char* dir, - const cmTarget&) + const char* dir, cmTarget&) { std::string d = cmSystemTools::ConvertToOutputPath(dir); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" @@ -517,8 +515,7 @@ void cmGlobalVisualStudio7Generator ::WriteProjectDepends(std::ostream& fout, const char* dspname, - const char*, - const cmTarget& target) + const char*, cmTarget& target) { int depcount = 0; // insert Begin Project Dependency Project_Dep_Name project stuff here diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 6396971..93d697d 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -86,11 +86,9 @@ 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, - const cmTarget &t); + const char* name, const char* path, cmTarget &t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, - const cmTarget &t); + const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b8267d6..9bf4770 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -190,7 +190,7 @@ void cmLocalGenerator::GenerateTestFiles() void cmLocalGenerator::GenerateInstallRules() { - const cmTargets &tgts = m_Makefile->GetTargets(); + cmTargets &tgts = m_Makefile->GetTargets(); const char* prefix = m_Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"); #if defined(_WIN32) && !defined(__CYGWIN__) @@ -283,7 +283,7 @@ void cmLocalGenerator::GenerateInstallRules() } std::string destination; - for(cmTargets::const_iterator l = tgts.begin(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT"); @@ -1164,8 +1164,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, * to the name of the library. This will not link a library against itself. */ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, - const char* targetLibrary, - const cmTarget &tgt) + const char* targetLibrary, + cmTarget &tgt) { // Try to emit each search path once std::set<cmStdString> emitted; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9a25b95..b5809fd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -154,7 +154,7 @@ protected: cmTarget&target); ///! put all the libraries for a target on into the given stream - virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &); + virtual void OutputLinkLibraries(std::ostream&, const char* name,cmTarget &); /** Get the include flags for the current makefile and language. */ diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 54e6cb3..69ded21 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -160,7 +160,7 @@ void cmLocalUnixMakefileGenerator3::FormatOutputPath(std::string& path, void cmLocalUnixMakefileGenerator3 -::WriteCustomCommands(const cmTarget &target,std::ostream& ruleFileStream, +::WriteCustomCommands(cmTarget &target,std::ostream& ruleFileStream, std::vector<std::string>& cleanFiles) { std::string tgtDir = m_Makefile->GetStartOutputDirectory(); @@ -303,7 +303,7 @@ const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 -::WriteTargetRuleFiles(const cmTarget& target) +::WriteTargetRuleFiles(cmTarget& target) { // Create a directory for this target. std::string dir = this->GetTargetDirectory(target); @@ -496,7 +496,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteObjectBuildFile(std::string &obj, const char *lang, - const cmTarget& target, + cmTarget& target, const cmSourceFile& source, std::vector<std::string>& depends, std::string &depMakeFile) @@ -649,7 +649,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 -::WriteObjectRuleFiles(const cmTarget& target, const cmSourceFile& source, +::WriteObjectRuleFiles(cmTarget& target, const cmSourceFile& source, std::vector<std::string>& objects) { // Identify the language of the source file. @@ -771,7 +771,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 -::WriteUtilityRuleFiles(const cmTarget& target) +::WriteUtilityRuleFiles(cmTarget& target) { // Create a directory for this target. std::string dir = this->GetTargetDirectory(target); @@ -1253,7 +1253,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 -::WriteTargetRequiresRule(std::ostream& ruleFileStream, const cmTarget& target, +::WriteTargetRequiresRule(std::ostream& ruleFileStream, cmTarget& target, const std::vector<std::string>& objects) { std::vector<std::string> depends; @@ -1285,7 +1285,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteExecutableRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles) @@ -1468,7 +1468,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteStaticLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles) @@ -1494,7 +1494,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteSharedLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles) @@ -1536,7 +1536,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteModuleLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles) @@ -1564,7 +1564,7 @@ void cmLocalUnixMakefileGenerator3 ::WriteLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, const char* linkRuleVar, @@ -1793,7 +1793,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::WriteObjectsVariable(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::string& variableName, @@ -1844,7 +1844,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::WriteTargetDependRule(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects) { std::vector<std::string> depends; @@ -1875,7 +1875,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::WriteTargetCleanRule(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& files) { std::vector<std::string> no_depends; @@ -1922,7 +1922,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- std::string -cmLocalUnixMakefileGenerator3::GetTargetDirectory(const cmTarget& target) +cmLocalUnixMakefileGenerator3::GetTargetDirectory(cmTarget& target) { std::string dir = target.GetName(); dir += ".dir"; @@ -1931,7 +1931,7 @@ cmLocalUnixMakefileGenerator3::GetTargetDirectory(const cmTarget& target) //---------------------------------------------------------------------------- std::string -cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(const cmTarget& target) +cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(cmTarget& target) { std::string dir = m_Makefile->GetStartOutputDirectory(); dir += "/"; @@ -1978,7 +1978,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::GetObjectFileName(const cmTarget& target, +::GetObjectFileName(cmTarget& target, const cmSourceFile& source) { // If the full path to the source file includes this directory, @@ -2087,7 +2087,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) void cmLocalUnixMakefileGenerator3 ::AppendTargetDepends(std::vector<std::string>& depends, - const cmTarget& target) + cmTarget& target) { // Do not bother with dependencies for static libraries. if(target.GetType() == cmTarget::STATIC_LIBRARY) @@ -2799,13 +2799,13 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // now write out the object rules // for each object file name - for (std::map<cmStdString,std::vector<const cmTarget *> >::iterator lo = + for (std::map<cmStdString,std::vector<cmTarget *> >::iterator lo = m_LocalObjectFiles.begin(); lo != m_LocalObjectFiles.end(); ++lo) { commands.clear(); // for each target using the object file - for (std::vector<const cmTarget *>::iterator to = + for (std::vector<cmTarget *>::iterator to = lo->second.begin(); to != lo->second.end(); ++to) { std::string tgtMakefileName = this->GetRelativeTargetDirectory(**to); @@ -2829,9 +2829,9 @@ void cmLocalUnixMakefileGenerator3 // for each target we just provide a rule to cd up to the top and do a make // on the target - const cmTargets& targets = m_Makefile->GetTargets(); + cmTargets& targets = m_Makefile->GetTargets(); std::string localName; - for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { if((t->second.GetType() == cmTarget::EXECUTABLE) || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4ee0ea1..826b053 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -135,7 +135,7 @@ public: void WriteSpecialTargetsTop(std::ostream& makefileStream); void WriteSpecialTargetsBottom(std::ostream& makefileStream); - std::string GetRelativeTargetDirectory(const cmTarget& target); + std::string GetRelativeTargetDirectory(cmTarget& target); // List the files for which to check dependency integrity. Each // language has its own list because integrity may be checked @@ -145,10 +145,10 @@ public: { return m_CheckDependFiles;} void AppendTargetDepends(std::vector<std::string>& depends, - const cmTarget& target); + cmTarget& target); void AppendGlobalTargetDepends(std::vector<std::string>& depends, - const cmTarget& target); + cmTarget& target); void AppendEcho(std::vector<std::string>& commands, const char* text); @@ -174,7 +174,7 @@ protected: // this is responsible for writing all of the rules for all this // directories custom commands (but not utility targets) - void WriteCustomCommands(const cmTarget &target,std::ostream& os, + void WriteCustomCommands(cmTarget &target,std::ostream& os, std::vector<std::string>& cleanFiles); // this method Writes the Directory informaiton files @@ -187,18 +187,18 @@ protected: void WriteCMakeArgument(std::ostream& os, const char* s); // write out all the rules for this target - void WriteTargetRuleFiles(const cmTarget& target); - void WriteUtilityRuleFiles(const cmTarget& target); + void WriteTargetRuleFiles(cmTarget& target); + void WriteUtilityRuleFiles(cmTarget& target); // create the rule files for an object - void WriteObjectRuleFiles(const cmTarget& target, + void WriteObjectRuleFiles(cmTarget& target, const cmSourceFile& source, std::vector<std::string>& objects); // write the build rule for an object void WriteObjectBuildFile(std::string &obj, const char *lang, - const cmTarget& target, + cmTarget& target, const cmSourceFile& source, std::vector<std::string>& depends, std::string &depMakeFile); @@ -230,21 +230,21 @@ protected: // these three make some simple changes and then call WriteLibraryRule void WriteStaticLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles); void WriteSharedLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles); void WriteModuleLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles); @@ -252,7 +252,7 @@ protected: // the main code for writing the Executable target rules void WriteExecutableRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::vector<std::string>& cleanFiles); @@ -260,7 +260,7 @@ protected: // the main method for writing library rules void WriteLibraryRule(std::ostream& ruleFileStream, const char* ruleFileName, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, const char* linkRuleVar, @@ -278,24 +278,24 @@ protected: const char* realTarget, const char* helpTarget); void WriteObjectsVariable(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects, const std::vector<std::string>& external_objects, std::string& variableName, std::string& variableNameExternal); void WriteTargetDependRule(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects); void WriteTargetCleanRule(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& files); void WriteTargetRequiresRule(std::ostream& ruleFileStream, - const cmTarget& target, + cmTarget& target, const std::vector<std::string>& objects); - std::string GetTargetDirectory(const cmTarget& target); + std::string GetTargetDirectory(cmTarget& target); std::string GetSubdirTargetName(const char* pass, const char* subdir); - std::string GetObjectFileName(const cmTarget& target, + std::string GetObjectFileName(cmTarget& target, const cmSourceFile& source); const char* GetSourceFileLanguage(const cmSourceFile& source); std::string ConvertToQuotedOutputPath(const char* p); @@ -347,7 +347,7 @@ private: // Set of object file names that will be built in this directory. std::set<cmStdString> m_ObjectFiles; - std::map<cmStdString,std::vector<const cmTarget *> > m_LocalObjectFiles; + std::map<cmStdString,std::vector<cmTarget *> > m_LocalObjectFiles; }; #endif diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index dfb1ca5..8ac9e7b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -562,7 +562,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout) void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, const char* libName, - const cmTarget& target) + cmTarget& target) { std::string root= m_Makefile->GetRequiredDefinition("CMAKE_ROOT"); const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY"); @@ -640,7 +640,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, // look for custom rules on a target and collect them together std::string -cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target, +cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, const char * /* libName */) { std::string customRuleCode = ""; @@ -741,8 +741,7 @@ inline std::string removeQuotes(const std::string& s) void cmLocalVisualStudio6Generator ::WriteDSPHeader(std::ostream& fout, - const char *libName, - const cmTarget &target, + const char *libName, cmTarget &target, std::vector<cmSourceGroup> &) { std::set<std::string> pathEmitted; diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index c96deb0..bf09f5c 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -51,7 +51,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType, const char* libName, const cmTarget&); + void SetBuildType(BuildType, const char* libName, cmTarget&); /** * Return array of created DSP names in a STL vector. @@ -76,7 +76,7 @@ private: void WriteDSPEndGroup(std::ostream& fout); void WriteDSPHeader(std::ostream& fout, const char *libName, - const cmTarget &tgt, std::vector<cmSourceGroup> &sgs); + cmTarget &tgt, std::vector<cmSourceGroup> &sgs); void WriteDSPFooter(std::ostream& fout); void AddDSPBuildRule(); @@ -91,7 +91,7 @@ private: std::vector<std::string>& depends, const cmCustomCommandLines& commandLines); - std::string CreateTargetRules(const cmTarget &target, + std::string CreateTargetRules(cmTarget &target, const char *libName); std::string m_IncludeOptions; std::vector<std::string> m_Configurations; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3760893..d081d20 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -183,7 +183,7 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule() void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, const char *libName, - const cmTarget &target) + cmTarget &target) { std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator)->GetConfigurations(); @@ -287,7 +287,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, const char* configName, const char *libName, - const cmTarget &target) + cmTarget &target) { // create a map of xml tags to the values they should have in the output // for example, "BufferSecurityCheck" = "TRUE" @@ -576,7 +576,7 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, const char *libName, - const cmTarget &target) + cmTarget &target) { std::string temp; std::string debugPostfix = ""; @@ -794,7 +794,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fout, - const cmTarget &target) + cmTarget &target) { std::vector<cmSourceFile*> const& classes = target.GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); @@ -814,7 +814,7 @@ void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fou void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout, const char*, const char*, - const cmTarget &tgt) + cmTarget &tgt) { bool hasone = false; if(m_LibraryOutputPath.size()) @@ -867,7 +867,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout, void cmLocalVisualStudio7Generator::OutputLibraries(std::ostream& fout, const char* configName, const char* libName, - const cmTarget &target) + cmTarget &target) { const cmTarget::LinkLibraries& libs = target.GetLinkLibraries(); cmTarget::LinkLibraries::const_iterator j; @@ -1224,8 +1224,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout) // look for custom rules on a target and collect them together void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, - const cmTarget &target, - const char * /* libName */) + cmTarget &target, + const char * /*libName*/) { if (target.GetType() > cmTarget::UTILITY) { @@ -1299,7 +1299,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const char *libName, - const cmTarget &, + cmTarget &, std::vector<cmSourceGroup> &) { fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n" diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 0821d36..c8cd0ed 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -69,41 +69,36 @@ private: std::string& flags); void OutputVCProjFile(); void WriteVCProjHeader(std::ostream& fout, const char *libName, - const cmTarget &tgt, std::vector<cmSourceGroup> &sgs); + cmTarget &tgt, std::vector<cmSourceGroup> &sgs); void WriteVCProjFooter(std::ostream& fout); void CreateSingleVCProj(const char *lname, cmTarget &tgt); void WriteVCProjFile(std::ostream& fout, const char *libName, cmTarget &tgt); void AddVCProjBuildRule(); void WriteConfigurations(std::ostream& fout, - const char *libName, - const cmTarget &tgt); + const char *libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, const char* configName, - const char* libName, - const cmTarget &tgt); + const char* libName, cmTarget &tgt); std::string EscapeForXML(const char* s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); void OutputDefineFlags(const char* flags, std::ostream& fout); - void OutputTargetRules(std::ostream& fout, - const cmTarget &target, + void OutputTargetRules(std::ostream& fout, cmTarget &target, const char *libName); void OutputBuildTool(std::ostream& fout, const char* configName, - const char* libname, const cmTarget& t); + const char* libname, cmTarget& t); void OutputLibraries(std::ostream& fout, const char* configName, const char* libName, - const cmTarget &target); + cmTarget &target); void OutputLibraryDirectories(std::ostream& fout, const char* configName, - const char* libName, - const cmTarget &target); - void OutputModuleDefinitionFile(std::ostream& fout, - const cmTarget &target); + const char* libName, cmTarget &target); + void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target); void WriteProjectStart(std::ostream& fout, const char *libName, - const cmTarget &tgt, std::vector<cmSourceGroup> &sgs); + cmTarget &tgt, std::vector<cmSourceGroup> &sgs); void WriteVCProjBeginGroup(std::ostream& fout, const char* group, const char* filter); diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 077bd19..02795eb 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -49,7 +49,7 @@ cmMakeDepend::~cmMakeDepend() // The pointer is kept so the cmSourceFile array can // be updated with the depend information in the cmMakefile. -void cmMakeDepend::SetMakefile(const cmMakefile* makefile) +void cmMakeDepend::SetMakefile(cmMakefile* makefile) { m_Makefile = makefile; @@ -264,8 +264,8 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, void cmMakeDepend::GenerateMakefileDependencies() { // Now create cmDependInformation objects for files in the directory - const cmTargets &tgts = m_Makefile->GetTargets(); - for(cmTargets::const_iterator l = tgts.begin(); + cmTargets &tgts = m_Makefile->GetTargets(); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { const std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles(); diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index 15ebc77..2a2e719 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -94,7 +94,7 @@ public: /** * Set the makefile that is used as a source of classes. */ - virtual void SetMakefile(const cmMakefile* makefile); + virtual void SetMakefile(cmMakefile* makefile); /** * Get the depend info struct for a source file @@ -153,7 +153,7 @@ protected: */ std::string FullPath(const char *filename, const char *extraPath); - const cmMakefile* m_Makefile; + cmMakefile* m_Makefile; bool m_Verbose; cmsys::RegularExpression m_IncludeFileRegularExpression; cmsys::RegularExpression m_ComplainFileRegularExpression; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fdc5aa2..ba57c3e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -179,13 +179,13 @@ void cmMakefile::PrintStringVector(const char* s, const std::vector<std::pair<cm // call print on all the classes in the makefile -void cmMakefile::Print() const +void cmMakefile::Print() { // print the class lists std::cout << "classes:\n"; std::cout << " m_Targets: "; - for (cmTargets::const_iterator l = m_Targets.begin(); + for (cmTargets::iterator l = m_Targets.begin(); l != m_Targets.end(); l++) { std::cout << l->first << std::endl; @@ -1078,10 +1078,10 @@ void cmMakefile::AddLibrary(const char* lname, int shared, target.ClearDependencyInformation( *this, lname ); target.SetInAll(true); target.GetSourceLists() = srcs; + target.SetMakefile(this); this->AddGlobalLinkInformation(lname, target); - cmTargets::iterator it = - m_Targets.insert(cmTargets::value_type(lname,target)).first; - + m_Targets.insert(cmTargets::value_type(lname,target)); + // Add an entry into the cache std::string libPath = lname; libPath += "_CMAKE_PATH"; @@ -1090,26 +1090,6 @@ void cmMakefile::AddLibrary(const char* lname, int shared, this->GetCurrentOutputDirectory(), "Path to a library", cmCacheManager::INTERNAL); - // set the LOCATION property of the target - std::string target_location; - target_location = this->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); - if ( target_location.size() == 0 ) - { - target_location += this->GetCurrentOutputDirectory(); - } - if ( target_location.size() > 0 ) - { - target_location += "/"; - } - const char* cfgid = this->GetDefinition("CMAKE_CFG_INTDIR"); - if ( cfgid && strcmp(cfgid, ".") != 0 ) - { - target_location += cfgid; - target_location += "/"; - } - target_location += target.GetFullName(this); - it->second.SetProperty("LOCATION",target_location.c_str()); - // Add an entry into the cache std::string ltname = lname; ltname += "_LIBRARY_TYPE"; @@ -1150,30 +1130,11 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName, target.SetType(cmTarget::EXECUTABLE, exeName); target.SetInAll(true); target.GetSourceLists() = srcs; + target.SetMakefile(this); this->AddGlobalLinkInformation(exeName, target); cmTargets::iterator it = m_Targets.insert(cmTargets::value_type(exeName,target)).first; - // set the LOCATION property of the target - std::string target_location; - target_location = this->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - if ( target_location.size() == 0 ) - { - target_location += this->GetCurrentOutputDirectory(); - } - if ( target_location.size() > 0 ) - { - target_location += "/"; - } - const char* cfgid = this->GetDefinition("CMAKE_CFG_INTDIR"); - if ( cfgid && strcmp(cfgid, ".") != 0 ) - { - target_location += cfgid; - target_location += "/"; - } - target_location += target.GetFullName(this); - it->second.SetProperty("LOCATION",target_location.c_str()); - // Add an entry into the cache std::string exePath = exeName; exePath += "_CMAKE_PATH"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 73c63aa..1eaa42d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -131,7 +131,7 @@ public: /** * Print the object state to std::cout. */ - void Print() const; + void Print(); /** Add a custom command to the build. */ void AddCustomCommandToTarget(const char* target, @@ -417,7 +417,6 @@ public: * Get the list of targets */ cmTargets &GetTargets() { return m_Targets; } - const cmTargets &GetTargets() const { return m_Targets; } cmTarget* FindTarget(const char* name); diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx index 66eb95f..afc7a5c 100644 --- a/Source/cmOrderLinkDirectories.cxx +++ b/Source/cmOrderLinkDirectories.cxx @@ -214,7 +214,7 @@ void cmOrderLinkDirectories::OrderPaths(std::vector<cmStdString>& } //------------------------------------------------------------------- -void cmOrderLinkDirectories::SetLinkInformation(const cmTarget& target, +void cmOrderLinkDirectories::SetLinkInformation(cmTarget& target, cmTarget::LinkLibraryType linktype, const char* targetLibrary) diff --git a/Source/cmOrderLinkDirectories.h b/Source/cmOrderLinkDirectories.h index 7d807f2..6fdf3de 100644 --- a/Source/cmOrderLinkDirectories.h +++ b/Source/cmOrderLinkDirectories.h @@ -49,7 +49,7 @@ class cmOrderLinkDirectories public: cmOrderLinkDirectories(); ///! set link information from the target - void SetLinkInformation(const cmTarget&, cmTarget::LinkLibraryType, + void SetLinkInformation(cmTarget&, cmTarget::LinkLibraryType, const char* targetLibrary); ///! Compute the best order for -L paths from GetLinkLibraries bool DetermineLibraryPathOrder(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 921a371..dfdde50 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -554,14 +554,14 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) void cmTarget::InsertDependency( DependencyMap& depMap, const cmStdString& lib, - const cmStdString& dep ) const + const cmStdString& dep ) { depMap[lib].push_back(dep); } void cmTarget::DeleteDependency( DependencyMap& depMap, const cmStdString& lib, - const cmStdString& dep ) const + const cmStdString& dep ) { // Make sure there is an entry in the map for lib. If so, delete all // dependencies to dep. There may be repeated entries because of @@ -582,7 +582,7 @@ void cmTarget::Emit( const std::string& lib, const DependencyMap& dep_map, std::set<cmStdString>& emitted, std::set<cmStdString>& visited, - std::vector<std::string>& link_line ) const + std::vector<std::string>& link_line ) { // It's already been emitted if( emitted.find(lib) != emitted.end() ) @@ -691,8 +691,52 @@ void cmTarget::SetProperty(const char* prop, const char* value) m_Properties[prop] = value; } -const char *cmTarget::GetProperty(const char* prop) const +void cmTarget::UpdateLocation() { + // set the LOCATION property of the target + std::string target_location; + switch( this->GetType() ) + { + case cmTarget::STATIC_LIBRARY: + case cmTarget::MODULE_LIBRARY: + case cmTarget::SHARED_LIBRARY: + target_location = + m_Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); + break; + case cmTarget::EXECUTABLE: + target_location = + m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); + break; + default: + return; + } + if ( target_location.size() == 0 ) + { + target_location += m_Makefile->GetCurrentOutputDirectory(); + } + if ( target_location.size() > 0 ) + { + target_location += "/"; + } + const char* cfgid = m_Makefile->GetDefinition("CMAKE_CFG_INTDIR"); + if ( cfgid && strcmp(cfgid, ".") != 0 ) + { + target_location += cfgid; + target_location += "/"; + } + target_location += this->GetFullName(m_Makefile); + this->SetProperty("LOCATION",target_location.c_str()); +} + +const char *cmTarget::GetProperty(const char* prop) +{ + // watch for special "computed" properties that are dependent on other + // properties or variables, always recompute them + if (!strcmp(prop,"LOCATION")) + { + this->UpdateLocation(); + } + std::map<cmStdString,cmStdString>::const_iterator i = m_Properties.find(prop); if (i != m_Properties.end()) @@ -702,7 +746,7 @@ const char *cmTarget::GetProperty(const char* prop) const return 0; } -bool cmTarget::GetPropertyAsBool(const char* prop) const +bool cmTarget::GetPropertyAsBool(const char* prop) { std::map<cmStdString,cmStdString>::const_iterator i = m_Properties.find(prop); @@ -713,7 +757,7 @@ bool cmTarget::GetPropertyAsBool(const char* prop) const return false; } -const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg) const +const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg) { if(this->GetProperty("HAS_CXX")) { @@ -795,12 +839,12 @@ const char* cmTarget::GetCreateRuleVariable() return ""; } -const char* cmTarget::GetSuffixVariable() const +const char* cmTarget::GetSuffixVariable() { return this->GetSuffixVariableInternal(this->GetType()); } -const char* cmTarget::GetSuffixVariableInternal(TargetType type) const +const char* cmTarget::GetSuffixVariableInternal(TargetType type) { switch(type) { @@ -821,12 +865,12 @@ const char* cmTarget::GetSuffixVariableInternal(TargetType type) const } -const char* cmTarget::GetPrefixVariable() const +const char* cmTarget::GetPrefixVariable() { return this->GetPrefixVariableInternal(this->GetType()); } -const char* cmTarget::GetPrefixVariableInternal(TargetType type) const +const char* cmTarget::GetPrefixVariableInternal(TargetType type) { switch(type) { @@ -846,13 +890,13 @@ const char* cmTarget::GetPrefixVariableInternal(TargetType type) const return ""; } -std::string cmTarget::GetFullName(cmMakefile* mf) const +std::string cmTarget::GetFullName(cmMakefile* mf) { return this->GetFullNameInternal(mf, this->GetType()); } std::string cmTarget::GetFullNameInternal(cmMakefile* mf, - TargetType type) const + TargetType type) { const char* targetPrefix = this->GetProperty("PREFIX"); const char* targetSuffix = this->GetProperty("SUFFIX"); @@ -896,13 +940,13 @@ std::string cmTarget::GetFullNameInternal(cmMakefile* mf, return name; } -std::string cmTarget::GetBaseName(cmMakefile* mf) const +std::string cmTarget::GetBaseName(cmMakefile* mf) { return this->GetBaseNameInternal(mf, this->GetType()); } std::string -cmTarget::GetBaseNameInternal(cmMakefile* mf, TargetType type) const +cmTarget::GetBaseNameInternal(cmMakefile* mf, TargetType type) { std::string pathPrefix = ""; #ifdef __APPLE__ @@ -942,7 +986,7 @@ void cmTarget::GetLibraryNames(cmMakefile* mf, std::string& name, std::string& soName, std::string& realName, - std::string& baseName) const + std::string& baseName) { // Get the names based on the real type of the library. this->GetLibraryNamesInternal(mf, name, soName, realName, this->GetType()); @@ -955,7 +999,7 @@ void cmTarget::GetLibraryCleanNames(cmMakefile* mf, std::string& staticName, std::string& sharedName, std::string& sharedSOName, - std::string& sharedRealName) const + std::string& sharedRealName) { // Get the name as if this were a static library. std::string soName; @@ -986,7 +1030,7 @@ void cmTarget::GetLibraryNamesInternal(cmMakefile* mf, std::string& name, std::string& soName, std::string& realName, - TargetType type) const + TargetType type) { // Construct the name of the soname flag variable for this language. const char* ll = diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 12fc440..17961fe 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -41,7 +41,7 @@ public: /** * Return the type of target. */ - TargetType GetType() const + TargetType GetType() { return m_TargetType; } @@ -52,43 +52,36 @@ public: void SetType(TargetType f, const char* name); ///! Set/Get the name of the target - const char* GetName() const {return m_Name.c_str();} + const char* GetName() {return m_Name.c_str();} /** * Indicate whether the target is part of the all target */ - bool IsInAll() const { return this->GetPropertyAsBool("IN_ALL"); } - bool GetInAll() const { return this->GetPropertyAsBool("IN_ALL"); } - void SetInAll(bool f) { this->SetProperty("IN_ALL", (f) ? "TRUE" : "FALSE"); } + bool IsInAll() { return this->GetPropertyAsBool("IN_ALL"); } + bool GetInAll() { return this->GetPropertyAsBool("IN_ALL"); } + void SetInAll(bool f) { this->SetProperty("IN_ALL", (f) ?"TRUE" : "FALSE"); } + + ///! Set the cmMakefile that owns this target + void SetMakefile(cmMakefile *mf) { m_Makefile = mf; }; /** * Get the list of the custom commands for this target */ - const std::vector<cmCustomCommand> &GetPreBuildCommands() const - {return m_PreBuildCommands;} std::vector<cmCustomCommand> &GetPreBuildCommands() {return m_PreBuildCommands;} - const std::vector<cmCustomCommand> &GetPreLinkCommands() const - {return m_PreLinkCommands;} std::vector<cmCustomCommand> &GetPreLinkCommands() {return m_PreLinkCommands;} - const std::vector<cmCustomCommand> &GetPostBuildCommands() const - {return m_PostBuildCommands;} std::vector<cmCustomCommand> &GetPostBuildCommands() {return m_PostBuildCommands;} /** * Get the list of the source lists used by this target */ - const std::vector<std::string> &GetSourceLists() const - {return m_SourceLists;} std::vector<std::string> &GetSourceLists() {return m_SourceLists;} /** * Get the list of the source files used by this target */ - const std::vector<cmSourceFile*> &GetSourceFiles() const - {return m_SourceFiles;} std::vector<cmSourceFile*> &GetSourceFiles() {return m_SourceFiles;} /** @@ -96,7 +89,7 @@ public: */ enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries; - const LinkLibraries &GetLinkLibraries() const {return m_LinkLibraries;} + const LinkLibraries &GetLinkLibraries() {return m_LinkLibraries;} /** * Clear the dependency information recorded for this target, if any. @@ -112,7 +105,8 @@ public: void MergeLinkLibraries( cmMakefile& mf, const char* selfname, const LinkLibraries& libs ); - const std::vector<std::string>& GetLinkDirectories() const {return m_LinkDirectories;} + const std::vector<std::string>& GetLinkDirectories() + {return m_LinkDirectories;} void AddLinkDirectory(const char* d); @@ -120,14 +114,14 @@ public: * Set the path where this target should be installed. This is relative to * INSTALL_PREFIX */ - std::string GetInstallPath() const {return m_InstallPath;} + std::string GetInstallPath() {return m_InstallPath;} void SetInstallPath(const char *name) {m_InstallPath = name;} /** * Set the path where this target (if it has a runtime part) should be * installed. This is relative to INSTALL_PREFIX */ - std::string GetRuntimeInstallPath() const {return m_RuntimeInstallPath;} + std::string GetRuntimeInstallPath() {return m_RuntimeInstallPath;} void SetRuntimeInstallPath(const char *name) {m_RuntimeInstallPath = name;} /** @@ -142,14 +136,14 @@ public: */ void AddUtility(const char* u) { m_Utilities.insert(u);} ///! Get the utilities used by this target - std::set<cmStdString>const& GetUtilities() const { return m_Utilities; } + std::set<cmStdString>const& GetUtilities() { return m_Utilities; } void AnalyzeLibDependencies( const cmMakefile& mf ); ///! Set/Get a property of this target file void SetProperty(const char *prop, const char *value); - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + const char *GetProperty(const char *prop); + bool GetPropertyAsBool(const char *prop); /** * Trace through the source files in this target and add al source files @@ -158,30 +152,30 @@ public: void TraceVSDependencies(std::string projName, cmMakefile *mf); ///! Return the prefered linker language for this target - const char* GetLinkerLanguage(cmGlobalGenerator*) const; + const char* GetLinkerLanguage(cmGlobalGenerator*); ///! Return the rule variable used to create this type of target, // need to add CMAKE_(LANG) for full name. const char* GetCreateRuleVariable(); ///! Return the name of the variable to look up the target suffix - const char* GetSuffixVariable() const; + const char* GetSuffixVariable(); ///! Return the name of the variable to look up the target suffix - const char* GetPrefixVariable() const; + const char* GetPrefixVariable(); /** Get the full name of the target according to the settings in the given makefile. */ - std::string GetFullName(cmMakefile* mf) const; + std::string GetFullName(cmMakefile* mf); /** Get the base name (no suffix) of the target according to the settings in the given makefile. */ - std::string GetBaseName(cmMakefile* mf) const; + std::string GetBaseName(cmMakefile* mf); /** Get the names of the library needed to generate a build rule that takes into account shared library version numbers. This should be called only on a library target. */ void GetLibraryNames(cmMakefile* mf, std::string& name, std::string& soName, std::string& realName, - std::string& baseName) const; + std::string& baseName); /** Get the names of the library used to remove existing copies of the library from the build tree either before linking or during @@ -191,7 +185,7 @@ public: std::string& staticName, std::string& sharedName, std::string& sharedSOName, - std::string& sharedRealName) const; + std::string& sharedRealName); private: /** * A list of direct dependencies. Use in conjunction with DependencyMap. @@ -216,14 +210,14 @@ private: */ void InsertDependency( DependencyMap& depMap, const cmStdString& lib, - const cmStdString& dep ) const; + const cmStdString& dep ); /* * Deletes \a dep from the dependency list of \a lib. */ void DeleteDependency( DependencyMap& depMap, const cmStdString& lib, - const cmStdString& dep ) const; + const cmStdString& dep ); /** * Emits the library \a lib and all its dependencies into link_line. @@ -237,7 +231,7 @@ private: const DependencyMap& dep_map, std::set<cmStdString>& emitted, std::set<cmStdString>& visited, - std::vector<std::string>& link_line ) const; + std::vector<std::string>& link_line ); /** * Finds the dependencies for \a lib and inserts them into \a @@ -246,15 +240,19 @@ private: void GatherDependencies( const cmMakefile& mf, const std::string& lib, DependencyMap& dep_map ); - const char* GetSuffixVariableInternal(TargetType type) const; - const char* GetPrefixVariableInternal(TargetType type) const; - std::string GetFullNameInternal(cmMakefile* mf, TargetType type) const; - std::string GetBaseNameInternal(cmMakefile* mf, TargetType type) const; + const char* GetSuffixVariableInternal(TargetType type); + const char* GetPrefixVariableInternal(TargetType type); + std::string GetFullNameInternal(cmMakefile* mf, TargetType type); + std::string GetBaseNameInternal(cmMakefile* mf, TargetType type); void GetLibraryNamesInternal(cmMakefile* mf, std::string& name, std::string& soName, std::string& realName, - TargetType type) const; + TargetType type); + + // update the value of the LOCATION var + void UpdateLocation(); + private: std::string m_Name; std::vector<cmCustomCommand> m_PreBuildCommands; @@ -271,6 +269,9 @@ private: std::set<cmStdString> m_Utilities; bool m_RecordDependencies; std::map<cmStdString,cmStdString> m_Properties; + + // the Makefile that owns this target + cmMakefile *m_Makefile; }; typedef std::map<cmStdString,cmTarget> cmTargets; |