Parcourir la source

ENH: make LOCATION an computed property of the target and get rid of a bunch of const junk

Ken Martin il y a 20 ans
Parent
commit
369308ca76

+ 1 - 1
Source/cmExportLibraryDependencies.cxx

@@ -91,7 +91,7 @@ void cmExportLibraryDependenciesCommand::FinalPass()
     cmTargets &tgts = gen->GetMakefile()->GetTargets();  
     cmTargets &tgts = gen->GetMakefile()->GetTargets();  
     std::vector<std::string> depends;
     std::vector<std::string> depends;
     const char *defType;
     const char *defType;
-    for(cmTargets::const_iterator l = tgts.begin();
+    for(cmTargets::iterator l = tgts.begin();
         l != tgts.end(); ++l)
         l != tgts.end(); ++l)
       {
       {
       if ((l->second.GetType() != cmTarget::INSTALL_FILES)
       if ((l->second.GetType() != cmTarget::INSTALL_FILES)

+ 2 - 2
Source/cmGlobalGenerator.cxx

@@ -531,9 +531,9 @@ void cmGlobalGenerator::Configure()
     {
     {
     manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager();
     manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager();
     m_LocalGenerators[i]->ConfigureFinalPass();
     m_LocalGenerators[i]->ConfigureFinalPass();
-    cmTargets const& targets = 
+    cmTargets & targets = 
       m_LocalGenerators[i]->GetMakefile()->GetTargets(); 
       m_LocalGenerators[i]->GetMakefile()->GetTargets(); 
-    for (cmTargets::const_iterator l = targets.begin();
+    for (cmTargets::iterator l = targets.begin();
          l != targets.end(); l++)
          l != targets.end(); l++)
       {
       {
       cmTarget::LinkLibraries libs = l->second.GetLinkLibraries();
       cmTarget::LinkLibraries libs = l->second.GetLinkLibraries();

+ 2 - 2
Source/cmGlobalKdevelopGenerator.cxx

@@ -78,7 +78,7 @@ void cmGlobalKdevelopGenerator::Generate()
     //run from kdevelop for now just pick the first executable found
     //run from kdevelop for now just pick the first executable found
     std::string executable;
     std::string executable;
     cmTargets& targets=mf->GetTargets();
     cmTargets& targets=mf->GetTargets();
-    for (cmTargets::const_iterator ti = targets.begin();
+    for (cmTargets::iterator ti = targets.begin();
          ti != targets.end(); ti++)
          ti != targets.end(); ti++)
       {
       {
       if (ti->second.GetType()==cmTarget::EXECUTABLE)
       if (ti->second.GetType()==cmTarget::EXECUTABLE)
@@ -134,7 +134,7 @@ bool cmGlobalKdevelopGenerator
   
   
     //get all sources
     //get all sources
     cmTargets& targets=makefile->GetTargets();
     cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::const_iterator ti = targets.begin();
+    for (cmTargets::iterator ti = targets.begin();
          ti != targets.end(); ti++)
          ti != targets.end(); ti++)
       {
       {
       const std::vector<cmSourceFile*>& sources=ti->second.GetSourceFiles();
       const std::vector<cmSourceFile*>& sources=ti->second.GetSourceFiles();

+ 11 - 11
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -467,7 +467,7 @@ cmGlobalUnixMakefileGenerator3
     std::vector<std::string> all_tgts;
     std::vector<std::string> all_tgts;
     
     
     // for all of out targets
     // 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++)
          l != lg->GetMakefile()->GetTargets().end(); l++)
       {
       {
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
@@ -528,7 +528,7 @@ cmGlobalUnixMakefileGenerator3
     std::vector<std::string> all_tgts;
     std::vector<std::string> all_tgts;
     
     
     // for all of out targets
     // 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++)
          l != lg->GetMakefile()->GetTargets().end(); l++)
       {
       {
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
@@ -597,7 +597,7 @@ cmGlobalUnixMakefileGenerator3
     std::vector<std::string> all_tgts;
     std::vector<std::string> all_tgts;
     
     
     // for all of out targets
     // 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++)
          l != lg->GetMakefile()->GetTargets().end(); l++)
       {
       {
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
@@ -658,7 +658,7 @@ cmGlobalUnixMakefileGenerator3
     std::vector<std::string> all_tgts;
     std::vector<std::string> all_tgts;
     
     
     // for all of out targets
     // 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++)
          l != lg->GetMakefile()->GetTargets().end(); l++)
       {
       {
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
       if((l->second.GetType() == cmTarget::EXECUTABLE) ||
@@ -713,8 +713,8 @@ cmGlobalUnixMakefileGenerator3
   depends.push_back("cmake_check_build_system");
   depends.push_back("cmake_check_build_system");
 
 
   // for each target Generate the rule files for each target.
   // 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) ||
     if((t->second.GetType() == cmTarget::EXECUTABLE) ||
        (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
        (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
@@ -767,9 +767,9 @@ cmGlobalUnixMakefileGenerator3
   depends.push_back("cmake_check_build_system");
   depends.push_back("cmake_check_build_system");
 
 
   // for each target Generate the rule files for each target.
   // 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);
   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) ||
     if (((t->second.GetType() == cmTarget::EXECUTABLE) ||
          (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
          (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
@@ -870,7 +870,7 @@ cmGlobalUnixMakefileGenerator3
 void
 void
 cmGlobalUnixMakefileGenerator3
 cmGlobalUnixMakefileGenerator3
 ::AppendGlobalTargetDepends(std::vector<std::string>& depends,
 ::AppendGlobalTargetDepends(std::vector<std::string>& depends,
-                            const cmTarget& target)
+                            cmTarget& target)
 {
 {
   // Keep track of dependencies already listed.
   // Keep track of dependencies already listed.
   std::set<cmStdString> emitted;
   std::set<cmStdString> emitted;
@@ -964,8 +964,8 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream)
     lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
     lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
   
   
     // for each target Generate the rule files for each target.
     // 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) ||
       if((t->second.GetType() == cmTarget::EXECUTABLE) ||
         (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
         (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||

+ 1 - 1
Source/cmGlobalUnixMakefileGenerator3.h

@@ -106,7 +106,7 @@ protected:
                             cmLocalUnixMakefileGenerator3 *lg);
                             cmLocalUnixMakefileGenerator3 *lg);
 
 
   void AppendGlobalTargetDepends(std::vector<std::string>& depends,
   void AppendGlobalTargetDepends(std::vector<std::string>& depends,
-                                 const cmTarget& target);
+                                 cmTarget& target);
   void AppendAnyGlobalDepend(std::vector<std::string>& depends, 
   void AppendAnyGlobalDepend(std::vector<std::string>& depends, 
                              const char* name);
                              const char* name);
 
 

+ 3 - 4
Source/cmGlobalVisualStudio6Generator.cxx

@@ -247,9 +247,8 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout,
           unsigned int j;
           unsigned int j;
           for(j = 0; j < generators.size(); ++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)
                 al != atgts.end(); ++al)
               {
               {
               if (al->second.IsInAll())
               if (al->second.IsInAll())
@@ -368,7 +367,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
 void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, 
 void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, 
                                                   const char* dspname,
                                                   const char* dspname,
                                                   const char* dir,
                                                   const char* dir,
-                                                  const cmTarget& target)
+                                                  cmTarget& target)
 {
 {
   fout << "#########################################################"
   fout << "#########################################################"
     "######################\n\n";
     "######################\n\n";

+ 1 - 2
Source/cmGlobalVisualStudio6Generator.h

@@ -79,8 +79,7 @@ private:
   void WriteDSWFile(std::ostream& fout);
   void WriteDSWFile(std::ostream& fout);
   void WriteDSWHeader(std::ostream& fout);
   void WriteDSWHeader(std::ostream& fout);
   void WriteProject(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, 
   void WriteExternalProject(std::ostream& fout, 
                             const char* name, const char* path,
                             const char* name, const char* path,
                             const std::vector<std::string>& dependencies);
                             const std::vector<std::string>& dependencies);

+ 4 - 6
Source/cmGlobalVisualStudio71Generator.cxx

@@ -96,9 +96,8 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
           unsigned int j;
           unsigned int j;
           for(j = 0; j < generators.size(); ++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)
                 al != atgts.end(); ++al)
               {
               {
               if (al->second.IsInAll())
               if (al->second.IsInAll())
@@ -229,7 +228,7 @@ void
 cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
 cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
                                               const char* dspname,
                                               const char* dspname,
                                               const char* dir,
                                               const char* dir,
-                                              const cmTarget& t)
+                                              cmTarget& t)
 {
 {
   std::string d = cmSystemTools::ConvertToOutputPath(dir);
   std::string d = cmSystemTools::ConvertToOutputPath(dir);
   fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
   fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
@@ -252,8 +251,7 @@ void
 cmGlobalVisualStudio71Generator
 cmGlobalVisualStudio71Generator
 ::WriteProjectDepends(std::ostream& fout,
 ::WriteProjectDepends(std::ostream& fout,
                       const char* dspname,
                       const char* dspname,
-                      const char*,
-                      const cmTarget& target)
+                      const char*, cmTarget& target)
 {
 {
   // insert Begin Project Dependency  Project_Dep_Name project stuff here 
   // insert Begin Project Dependency  Project_Dep_Name project stuff here 
   if (target.GetType() != cmTarget::STATIC_LIBRARY)
   if (target.GetType() != cmTarget::STATIC_LIBRARY)

+ 2 - 4
Source/cmGlobalVisualStudio71Generator.h

@@ -47,11 +47,9 @@ protected:
                             cmLocalGenerator* root,
                             cmLocalGenerator* root,
                             std::vector<cmLocalGenerator*>& generators);
                             std::vector<cmLocalGenerator*>& generators);
   virtual void WriteProject(std::ostream& fout, 
   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, 
   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 WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all);
   virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path,
   virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path,
                                     const std::vector<std::string>& depends);
                                     const std::vector<std::string>& depends);

+ 4 - 7
Source/cmGlobalVisualStudio7Generator.cxx

@@ -312,9 +312,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout,
           unsigned int j;
           unsigned int j;
           for(j = 0; j < generators.size(); ++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)
                 al != atgts.end(); ++al)
               {
               {
               if (al->second.IsInAll())
               if (al->second.IsInAll())
@@ -498,8 +497,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout,
 // the libraries it uses are also done here
 // the libraries it uses are also done here
 void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, 
 void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, 
                                const char* dspname,
                                const char* dspname,
-                               const char* dir,
-                               const cmTarget&)
+                               const char* dir, cmTarget&)
 {
 {
   std::string d = cmSystemTools::ConvertToOutputPath(dir);
   std::string d = cmSystemTools::ConvertToOutputPath(dir);
   fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
   fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
@@ -517,8 +515,7 @@ void
 cmGlobalVisualStudio7Generator
 cmGlobalVisualStudio7Generator
 ::WriteProjectDepends(std::ostream& fout,
 ::WriteProjectDepends(std::ostream& fout,
                       const char* dspname,
                       const char* dspname,
-                      const char*,
-                      const cmTarget& target)
+                      const char*, cmTarget& target)
 {
 {
   int depcount = 0;
   int depcount = 0;
   // insert Begin Project Dependency  Project_Dep_Name project stuff here 
   // insert Begin Project Dependency  Project_Dep_Name project stuff here 

+ 2 - 4
Source/cmGlobalVisualStudio7Generator.h

@@ -86,11 +86,9 @@ protected:
   virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
   virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
                             std::vector<cmLocalGenerator*>& generators);
                             std::vector<cmLocalGenerator*>& generators);
   virtual void WriteProject(std::ostream& fout, 
   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, 
   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 WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all);
   virtual void WriteSLNFooter(std::ostream& fout);
   virtual void WriteSLNFooter(std::ostream& fout);
   virtual void WriteSLNHeader(std::ostream& fout);
   virtual void WriteSLNHeader(std::ostream& fout);

+ 4 - 4
Source/cmLocalGenerator.cxx

@@ -190,7 +190,7 @@ void cmLocalGenerator::GenerateTestFiles()
 
 
 void cmLocalGenerator::GenerateInstallRules()
 void cmLocalGenerator::GenerateInstallRules()
 {
 {
-  const cmTargets &tgts = m_Makefile->GetTargets();
+  cmTargets &tgts = m_Makefile->GetTargets();
   const char* prefix
   const char* prefix
     = m_Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
     = m_Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -283,7 +283,7 @@ void cmLocalGenerator::GenerateInstallRules()
     }
     }
 
 
   std::string destination;
   std::string destination;
-  for(cmTargets::const_iterator l = tgts.begin(); 
+  for(cmTargets::iterator l = tgts.begin(); 
     l != tgts.end(); l++)
     l != tgts.end(); l++)
     {
     {
     const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT");
     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.
  * to the name of the library.  This will not link a library against itself.
  */
  */
 void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
 void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
-                                                  const char* targetLibrary,
-                                                  const cmTarget &tgt)
+                                           const char* targetLibrary,
+                                           cmTarget &tgt)
 {
 {
   // Try to emit each search path once
   // Try to emit each search path once
   std::set<cmStdString> emitted;
   std::set<cmStdString> emitted;

+ 1 - 1
Source/cmLocalGenerator.h

@@ -154,7 +154,7 @@ protected:
                       cmTarget&target);
                       cmTarget&target);
   
   
   ///! put all the libraries for a target on into the given stream
   ///! 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.  */
   /** Get the include flags for the current makefile and language.  */

+ 22 - 22
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -160,7 +160,7 @@ void cmLocalUnixMakefileGenerator3::FormatOutputPath(std::string& path,
 
 
 
 
 void cmLocalUnixMakefileGenerator3
 void cmLocalUnixMakefileGenerator3
-::WriteCustomCommands(const cmTarget &target,std::ostream& ruleFileStream,
+::WriteCustomCommands(cmTarget &target,std::ostream& ruleFileStream,
                       std::vector<std::string>& cleanFiles)
                       std::vector<std::string>& cleanFiles)
 {
 {
   std::string tgtDir = m_Makefile->GetStartOutputDirectory();
   std::string tgtDir = m_Makefile->GetStartOutputDirectory();
@@ -303,7 +303,7 @@ const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath()
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
-::WriteTargetRuleFiles(const cmTarget& target)
+::WriteTargetRuleFiles(cmTarget& target)
 {
 {
   // Create a directory for this target.
   // Create a directory for this target.
   std::string dir = this->GetTargetDirectory(target);
   std::string dir = this->GetTargetDirectory(target);
@@ -496,7 +496,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteObjectBuildFile(std::string &obj,
 ::WriteObjectBuildFile(std::string &obj,
                        const char *lang, 
                        const char *lang, 
-                       const cmTarget& target, 
+                       cmTarget& target, 
                        const cmSourceFile& source,
                        const cmSourceFile& source,
                        std::vector<std::string>& depends,
                        std::vector<std::string>& depends,
                        std::string &depMakeFile)
                        std::string &depMakeFile)
@@ -649,7 +649,7 @@ cmLocalUnixMakefileGenerator3
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
-::WriteObjectRuleFiles(const cmTarget& target, const cmSourceFile& source,
+::WriteObjectRuleFiles(cmTarget& target, const cmSourceFile& source,
                        std::vector<std::string>& objects)
                        std::vector<std::string>& objects)
 {
 {
   // Identify the language of the source file.
   // Identify the language of the source file.
@@ -771,7 +771,7 @@ cmLocalUnixMakefileGenerator3
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
-::WriteUtilityRuleFiles(const cmTarget& target)
+::WriteUtilityRuleFiles(cmTarget& target)
 {
 {
   // Create a directory for this target.
   // Create a directory for this target.
   std::string dir = this->GetTargetDirectory(target);
   std::string dir = this->GetTargetDirectory(target);
@@ -1253,7 +1253,7 @@ cmLocalUnixMakefileGenerator3
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
-::WriteTargetRequiresRule(std::ostream& ruleFileStream, const cmTarget& target,
+::WriteTargetRequiresRule(std::ostream& ruleFileStream, cmTarget& target,
                           const std::vector<std::string>& objects)
                           const std::vector<std::string>& objects)
 {
 {
   std::vector<std::string> depends;
   std::vector<std::string> depends;
@@ -1285,7 +1285,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteExecutableRule(std::ostream& ruleFileStream,
 ::WriteExecutableRule(std::ostream& ruleFileStream,
                       const char* ruleFileName,
                       const char* ruleFileName,
-                      const cmTarget& target,
+                      cmTarget& target,
                       const std::vector<std::string>& objects,
                       const std::vector<std::string>& objects,
                       const std::vector<std::string>& external_objects,
                       const std::vector<std::string>& external_objects,
                       std::vector<std::string>& cleanFiles)
                       std::vector<std::string>& cleanFiles)
@@ -1468,7 +1468,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteStaticLibraryRule(std::ostream& ruleFileStream,
 ::WriteStaticLibraryRule(std::ostream& ruleFileStream,
                          const char* ruleFileName,
                          const char* ruleFileName,
-                         const cmTarget& target,
+                         cmTarget& target,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& external_objects,
                          const std::vector<std::string>& external_objects,
                          std::vector<std::string>& cleanFiles)
                          std::vector<std::string>& cleanFiles)
@@ -1494,7 +1494,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteSharedLibraryRule(std::ostream& ruleFileStream,
 ::WriteSharedLibraryRule(std::ostream& ruleFileStream,
                          const char* ruleFileName,
                          const char* ruleFileName,
-                         const cmTarget& target,
+                         cmTarget& target,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& external_objects,
                          const std::vector<std::string>& external_objects,
                          std::vector<std::string>& cleanFiles)
                          std::vector<std::string>& cleanFiles)
@@ -1536,7 +1536,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteModuleLibraryRule(std::ostream& ruleFileStream,
 ::WriteModuleLibraryRule(std::ostream& ruleFileStream,
                          const char* ruleFileName,
                          const char* ruleFileName,
-                         const cmTarget& target,
+                         cmTarget& target,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& objects,
                          const std::vector<std::string>& external_objects,
                          const std::vector<std::string>& external_objects,
                          std::vector<std::string>& cleanFiles)
                          std::vector<std::string>& cleanFiles)
@@ -1564,7 +1564,7 @@ void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteLibraryRule(std::ostream& ruleFileStream,
 ::WriteLibraryRule(std::ostream& ruleFileStream,
                    const char* ruleFileName,
                    const char* ruleFileName,
-                   const cmTarget& target,
+                   cmTarget& target,
                    const std::vector<std::string>& objects,
                    const std::vector<std::string>& objects,
                    const std::vector<std::string>& external_objects,
                    const std::vector<std::string>& external_objects,
                    const char* linkRuleVar,
                    const char* linkRuleVar,
@@ -1793,7 +1793,7 @@ cmLocalUnixMakefileGenerator3
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteObjectsVariable(std::ostream& ruleFileStream,
 ::WriteObjectsVariable(std::ostream& ruleFileStream,
-                       const cmTarget& target,
+                       cmTarget& target,
                        const std::vector<std::string>& objects,
                        const std::vector<std::string>& objects,
                        const std::vector<std::string>& external_objects,
                        const std::vector<std::string>& external_objects,
                        std::string& variableName,
                        std::string& variableName,
@@ -1844,7 +1844,7 @@ cmLocalUnixMakefileGenerator3
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteTargetDependRule(std::ostream& ruleFileStream,
 ::WriteTargetDependRule(std::ostream& ruleFileStream,
-                        const cmTarget& target,
+                        cmTarget& target,
                         const std::vector<std::string>& objects)
                         const std::vector<std::string>& objects)
 {
 {
   std::vector<std::string> depends;
   std::vector<std::string> depends;
@@ -1875,7 +1875,7 @@ cmLocalUnixMakefileGenerator3
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::WriteTargetCleanRule(std::ostream& ruleFileStream,
 ::WriteTargetCleanRule(std::ostream& ruleFileStream,
-                       const cmTarget& target,
+                       cmTarget& target,
                        const std::vector<std::string>& files)
                        const std::vector<std::string>& files)
 {
 {
   std::vector<std::string> no_depends;
   std::vector<std::string> no_depends;
@@ -1922,7 +1922,7 @@ cmLocalUnixMakefileGenerator3
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string
 std::string
-cmLocalUnixMakefileGenerator3::GetTargetDirectory(const cmTarget& target)
+cmLocalUnixMakefileGenerator3::GetTargetDirectory(cmTarget& target)
 {
 {
   std::string dir = target.GetName();
   std::string dir = target.GetName();
   dir += ".dir";
   dir += ".dir";
@@ -1931,7 +1931,7 @@ cmLocalUnixMakefileGenerator3::GetTargetDirectory(const cmTarget& target)
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string
 std::string
-cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(const cmTarget& target)
+cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(cmTarget& target)
 {
 {
   std::string dir = m_Makefile->GetStartOutputDirectory();
   std::string dir = m_Makefile->GetStartOutputDirectory();
   dir += "/";
   dir += "/";
@@ -1978,7 +1978,7 @@ cmLocalUnixMakefileGenerator3
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string
 std::string
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
-::GetObjectFileName(const cmTarget& target,
+::GetObjectFileName(cmTarget& target,
                     const cmSourceFile& source)
                     const cmSourceFile& source)
 {
 {
   // If the full path to the source file includes this directory,
   // If the full path to the source file includes this directory,
@@ -2087,7 +2087,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
 void
 void
 cmLocalUnixMakefileGenerator3
 cmLocalUnixMakefileGenerator3
 ::AppendTargetDepends(std::vector<std::string>& depends,
 ::AppendTargetDepends(std::vector<std::string>& depends,
-                      const cmTarget& target)
+                      cmTarget& target)
 {
 {
   // Do not bother with dependencies for static libraries.
   // Do not bother with dependencies for static libraries.
   if(target.GetType() == cmTarget::STATIC_LIBRARY)
   if(target.GetType() == cmTarget::STATIC_LIBRARY)
@@ -2799,13 +2799,13 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
   
   
   // now write out the object rules
   // now write out the object rules
   // for each object file name
   // 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();
          m_LocalObjectFiles.begin();
        lo != m_LocalObjectFiles.end(); ++lo)
        lo != m_LocalObjectFiles.end(); ++lo)
     {
     {
     commands.clear();
     commands.clear();
     // for each target using the object file
     // 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)
            lo->second.begin(); to != lo->second.end(); ++to)
       {
       {
       std::string tgtMakefileName = this->GetRelativeTargetDirectory(**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
   // for each target we just provide a rule to cd up to the top and do a make
   // on the target
   // on the target
-  const cmTargets& targets = m_Makefile->GetTargets();
+  cmTargets& targets = m_Makefile->GetTargets();
   std::string localName;
   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) ||
     if((t->second.GetType() == cmTarget::EXECUTABLE) ||
        (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
        (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||

+ 20 - 20
Source/cmLocalUnixMakefileGenerator3.h

@@ -135,7 +135,7 @@ public:
   void WriteSpecialTargetsTop(std::ostream& makefileStream);
   void WriteSpecialTargetsTop(std::ostream& makefileStream);
 
 
   void WriteSpecialTargetsBottom(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
   // List the files for which to check dependency integrity.  Each
   // language has its own list because integrity may be checked
   // language has its own list because integrity may be checked
@@ -145,10 +145,10 @@ public:
   { return m_CheckDependFiles;}
   { return m_CheckDependFiles;}
   
   
   void AppendTargetDepends(std::vector<std::string>& depends,
   void AppendTargetDepends(std::vector<std::string>& depends,
-                           const cmTarget& target);
+                           cmTarget& target);
 
 
   void AppendGlobalTargetDepends(std::vector<std::string>& depends,
   void AppendGlobalTargetDepends(std::vector<std::string>& depends,
-                                 const cmTarget& target);
+                                 cmTarget& target);
 
 
   void AppendEcho(std::vector<std::string>& commands,
   void AppendEcho(std::vector<std::string>& commands,
                   const char* text);
                   const char* text);
@@ -174,7 +174,7 @@ protected:
 
 
   // this is responsible for writing all of the rules for all this
   // this is responsible for writing all of the rules for all this
   // directories custom commands (but not utility targets)
   // 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);
                            std::vector<std::string>& cleanFiles);
   
   
   // this method Writes the Directory informaiton files
   // this method Writes the Directory informaiton files
@@ -187,18 +187,18 @@ protected:
   void WriteCMakeArgument(std::ostream& os, const char* s);
   void WriteCMakeArgument(std::ostream& os, const char* s);
 
 
   // write out all the rules for this target
   // 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
   // create the rule files for an object
-  void WriteObjectRuleFiles(const cmTarget& target,
+  void WriteObjectRuleFiles(cmTarget& target,
                             const cmSourceFile& source,
                             const cmSourceFile& source,
                             std::vector<std::string>& objects);
                             std::vector<std::string>& objects);
 
 
   // write the build rule for an object
   // write the build rule for an object
   void WriteObjectBuildFile(std::string &obj,
   void WriteObjectBuildFile(std::string &obj,
                             const char *lang, 
                             const char *lang, 
-                            const cmTarget& target, 
+                            cmTarget& target, 
                             const cmSourceFile& source,
                             const cmSourceFile& source,
                             std::vector<std::string>& depends,
                             std::vector<std::string>& depends,
                             std::string &depMakeFile);
                             std::string &depMakeFile);
@@ -230,21 +230,21 @@ protected:
   // these three make some simple changes and then call WriteLibraryRule
   // these three make some simple changes and then call WriteLibraryRule
   void WriteStaticLibraryRule(std::ostream& ruleFileStream,
   void WriteStaticLibraryRule(std::ostream& ruleFileStream,
                               const char* ruleFileName,
                               const char* ruleFileName,
-                              const cmTarget& target,
+                              cmTarget& target,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& external_objects,
                               const std::vector<std::string>& external_objects,
                               std::vector<std::string>& cleanFiles);
                               std::vector<std::string>& cleanFiles);
   
   
   void WriteSharedLibraryRule(std::ostream& ruleFileStream,
   void WriteSharedLibraryRule(std::ostream& ruleFileStream,
                               const char* ruleFileName,
                               const char* ruleFileName,
-                              const cmTarget& target,
+                              cmTarget& target,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& external_objects,
                               const std::vector<std::string>& external_objects,
                               std::vector<std::string>& cleanFiles);
                               std::vector<std::string>& cleanFiles);
   
   
   void WriteModuleLibraryRule(std::ostream& ruleFileStream,
   void WriteModuleLibraryRule(std::ostream& ruleFileStream,
                               const char* ruleFileName,
                               const char* ruleFileName,
-                              const cmTarget& target,
+                              cmTarget& target,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& objects,
                               const std::vector<std::string>& external_objects,
                               const std::vector<std::string>& external_objects,
                               std::vector<std::string>& cleanFiles);
                               std::vector<std::string>& cleanFiles);
@@ -252,7 +252,7 @@ protected:
   // the main code for writing the Executable target rules
   // the main code for writing the Executable target rules
   void WriteExecutableRule(std::ostream& ruleFileStream,
   void WriteExecutableRule(std::ostream& ruleFileStream,
                            const char* ruleFileName,
                            const char* ruleFileName,
-                           const cmTarget& target,
+                           cmTarget& target,
                            const std::vector<std::string>& objects,
                            const std::vector<std::string>& objects,
                            const std::vector<std::string>& external_objects,
                            const std::vector<std::string>& external_objects,
                            std::vector<std::string>& cleanFiles);
                            std::vector<std::string>& cleanFiles);
@@ -260,7 +260,7 @@ protected:
   // the main method for writing library rules
   // the main method for writing library rules
   void WriteLibraryRule(std::ostream& ruleFileStream,
   void WriteLibraryRule(std::ostream& ruleFileStream,
                         const char* ruleFileName,
                         const char* ruleFileName,
-                        const cmTarget& target,
+                        cmTarget& target,
                         const std::vector<std::string>& objects,
                         const std::vector<std::string>& objects,
                         const std::vector<std::string>& external_objects,
                         const std::vector<std::string>& external_objects,
                         const char* linkRuleVar,
                         const char* linkRuleVar,
@@ -278,24 +278,24 @@ protected:
                             const char* realTarget,
                             const char* realTarget,
                             const char* helpTarget);
                             const char* helpTarget);
   void WriteObjectsVariable(std::ostream& ruleFileStream,
   void WriteObjectsVariable(std::ostream& ruleFileStream,
-                            const cmTarget& target,
+                            cmTarget& target,
                             const std::vector<std::string>& objects,
                             const std::vector<std::string>& objects,
                             const std::vector<std::string>& external_objects,
                             const std::vector<std::string>& external_objects,
                             std::string& variableName,
                             std::string& variableName,
                             std::string& variableNameExternal);
                             std::string& variableNameExternal);
   void WriteTargetDependRule(std::ostream& ruleFileStream,
   void WriteTargetDependRule(std::ostream& ruleFileStream,
-                             const cmTarget& target,
+                             cmTarget& target,
                              const std::vector<std::string>& objects);
                              const std::vector<std::string>& objects);
   void WriteTargetCleanRule(std::ostream& ruleFileStream,
   void WriteTargetCleanRule(std::ostream& ruleFileStream,
-                            const cmTarget& target,
+                            cmTarget& target,
                             const std::vector<std::string>& files);
                             const std::vector<std::string>& files);
   void WriteTargetRequiresRule(std::ostream& ruleFileStream,
   void WriteTargetRequiresRule(std::ostream& ruleFileStream,
-                               const cmTarget& target,
+                               cmTarget& target,
                                const std::vector<std::string>& objects);
                                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 GetSubdirTargetName(const char* pass, const char* subdir);
-  std::string GetObjectFileName(const cmTarget& target,
+  std::string GetObjectFileName(cmTarget& target,
                                 const cmSourceFile& source);
                                 const cmSourceFile& source);
   const char* GetSourceFileLanguage(const cmSourceFile& source);
   const char* GetSourceFileLanguage(const cmSourceFile& source);
   std::string ConvertToQuotedOutputPath(const char* p);
   std::string ConvertToQuotedOutputPath(const char* p);
@@ -347,7 +347,7 @@ private:
   // Set of object file names that will be built in this directory.
   // Set of object file names that will be built in this directory.
   std::set<cmStdString> m_ObjectFiles;
   std::set<cmStdString> m_ObjectFiles;
 
 
-  std::map<cmStdString,std::vector<const cmTarget *> > m_LocalObjectFiles;
+  std::map<cmStdString,std::vector<cmTarget *> > m_LocalObjectFiles;
 };
 };
 
 
 #endif
 #endif

+ 3 - 4
Source/cmLocalVisualStudio6Generator.cxx

@@ -562,7 +562,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout)
 
 
 void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
 void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
                                                  const char* libName,
                                                  const char* libName,
-                                                 const cmTarget& target)
+                                                 cmTarget& target)
 {
 {
   std::string root= m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
   std::string root= m_Makefile->GetRequiredDefinition("CMAKE_ROOT");
   const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
   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
 // look for custom rules on a target and collect them together
 std::string 
 std::string 
-cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target, 
+cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, 
                                                  const char * /* libName */)
                                                  const char * /* libName */)
 {
 {
   std::string customRuleCode = "";
   std::string customRuleCode = "";
@@ -741,8 +741,7 @@ inline std::string removeQuotes(const std::string& s)
   
   
 void cmLocalVisualStudio6Generator
 void cmLocalVisualStudio6Generator
 ::WriteDSPHeader(std::ostream& fout, 
 ::WriteDSPHeader(std::ostream& fout, 
-                 const char *libName,
-                 const cmTarget &target, 
+                 const char *libName, cmTarget &target, 
                  std::vector<cmSourceGroup> &)
                  std::vector<cmSourceGroup> &)
 {
 {
   std::set<std::string> pathEmitted;
   std::set<std::string> pathEmitted;

+ 3 - 3
Source/cmLocalVisualStudio6Generator.h

@@ -51,7 +51,7 @@ public:
   /**
   /**
    * Specify the type of the build: static, dll, or executable.
    * 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.
    * Return array of created DSP names in a STL vector.
@@ -76,7 +76,7 @@ private:
   void WriteDSPEndGroup(std::ostream& fout);
   void WriteDSPEndGroup(std::ostream& fout);
 
 
   void WriteDSPHeader(std::ostream& fout, const char *libName,
   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 WriteDSPFooter(std::ostream& fout);
   void AddDSPBuildRule();
   void AddDSPBuildRule();
@@ -91,7 +91,7 @@ private:
                              std::vector<std::string>& depends,
                              std::vector<std::string>& depends,
                              const cmCustomCommandLines& commandLines);
                              const cmCustomCommandLines& commandLines);
 
 
-  std::string CreateTargetRules(const cmTarget &target, 
+  std::string CreateTargetRules(cmTarget &target, 
                                 const char *libName);
                                 const char *libName);
   std::string m_IncludeOptions;
   std::string m_IncludeOptions;
   std::vector<std::string> m_Configurations;
   std::vector<std::string> m_Configurations;

+ 9 - 9
Source/cmLocalVisualStudio7Generator.cxx

@@ -183,7 +183,7 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
 
 
 void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, 
 void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, 
                                                         const char *libName,
                                                         const char *libName,
-                                                        const cmTarget &target)
+                                                        cmTarget &target)
 {
 {
   std::vector<std::string> *configs = 
   std::vector<std::string> *configs = 
     static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator)->GetConfigurations();
     static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator)->GetConfigurations();
@@ -287,7 +287,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
 void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, 
 void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, 
                                              const char* configName,
                                              const char* configName,
                                              const char *libName,
                                              const char *libName,
-                                             const cmTarget &target)
+                                             cmTarget &target)
 { 
 { 
   // create a map of xml tags to the values they should have in the output
   // create a map of xml tags to the values they should have in the output
   // for example, "BufferSecurityCheck" = "TRUE"
   // for example, "BufferSecurityCheck" = "TRUE"
@@ -576,7 +576,7 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags(
 void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
 void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
                                           const char* configName,
                                           const char* configName,
                                           const char *libName,
                                           const char *libName,
-                                          const cmTarget &target)
+                                          cmTarget &target)
 { 
 { 
   std::string temp;
   std::string temp;
   std::string debugPostfix = "";
   std::string debugPostfix = "";
@@ -794,7 +794,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
 }
 }
 
 
 void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fout,
 void cmLocalVisualStudio7Generator::OutputModuleDefinitionFile(std::ostream& fout,
-                                                     const cmTarget &target)
+                                                     cmTarget &target)
 {
 {
   std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
   std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
   for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); 
   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,
 void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout,
                                                    const char*,
                                                    const char*,
                                                    const char*,
                                                    const char*,
-                                                   const cmTarget &tgt)
+                                                   cmTarget &tgt)
 { 
 { 
   bool hasone = false;
   bool hasone = false;
   if(m_LibraryOutputPath.size())
   if(m_LibraryOutputPath.size())
@@ -867,7 +867,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout,
 void cmLocalVisualStudio7Generator::OutputLibraries(std::ostream& fout,
 void cmLocalVisualStudio7Generator::OutputLibraries(std::ostream& fout,
                                           const char* configName,
                                           const char* configName,
                                           const char* libName,
                                           const char* libName,
-                                          const cmTarget &target)
+                                          cmTarget &target)
 {
 {
   const cmTarget::LinkLibraries& libs = target.GetLinkLibraries();
   const cmTarget::LinkLibraries& libs = target.GetLinkLibraries();
   cmTarget::LinkLibraries::const_iterator j;
   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
 // look for custom rules on a target and collect them together
 void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout,
 void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout,
-                                                      const cmTarget &target, 
-                                                      const char * /* libName */)
+                                                      cmTarget &target, 
+                                                      const char * /*libName*/)
 {
 {
   if (target.GetType() > cmTarget::UTILITY)
   if (target.GetType() > cmTarget::UTILITY)
     {
     {
@@ -1299,7 +1299,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(std::ostream& fout,
 void 
 void 
 cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, 
 cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, 
                                                  const char *libName,
                                                  const char *libName,
-                                                 const cmTarget &, 
+                                                 cmTarget &, 
                                                  std::vector<cmSourceGroup> &)
                                                  std::vector<cmSourceGroup> &)
 {
 {
   fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
   fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"

+ 9 - 14
Source/cmLocalVisualStudio7Generator.h

@@ -69,41 +69,36 @@ private:
                                    std::string& flags);
                                    std::string& flags);
   void OutputVCProjFile();
   void OutputVCProjFile();
   void WriteVCProjHeader(std::ostream& fout, const char *libName,
   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 WriteVCProjFooter(std::ostream& fout);
   void CreateSingleVCProj(const char *lname, cmTarget &tgt);
   void CreateSingleVCProj(const char *lname, cmTarget &tgt);
   void WriteVCProjFile(std::ostream& fout, const char *libName, 
   void WriteVCProjFile(std::ostream& fout, const char *libName, 
                        cmTarget &tgt);
                        cmTarget &tgt);
   void AddVCProjBuildRule();
   void AddVCProjBuildRule();
   void WriteConfigurations(std::ostream& fout,
   void WriteConfigurations(std::ostream& fout,
-                           const char *libName,
-                           const cmTarget &tgt);
+                           const char *libName, cmTarget &tgt);
   void WriteConfiguration(std::ostream& fout,
   void WriteConfiguration(std::ostream& fout,
                           const char* configName,
                           const char* configName,
-                          const char* libName,
-                          const cmTarget &tgt); 
+                          const char* libName, cmTarget &tgt); 
   std::string EscapeForXML(const char* s);
   std::string EscapeForXML(const char* s);
   std::string ConvertToXMLOutputPath(const char* path);
   std::string ConvertToXMLOutputPath(const char* path);
   std::string ConvertToXMLOutputPathSingle(const char* path);
   std::string ConvertToXMLOutputPathSingle(const char* path);
   void OutputDefineFlags(const char* flags,
   void OutputDefineFlags(const char* flags,
                          std::ostream& fout);
                          std::ostream& fout);
-  void OutputTargetRules(std::ostream& fout,
-                         const cmTarget &target, 
+  void OutputTargetRules(std::ostream& fout, cmTarget &target, 
                          const char *libName);
                          const char *libName);
   void OutputBuildTool(std::ostream& fout, const char* configName,
   void OutputBuildTool(std::ostream& fout, const char* configName,
-                       const char* libname, const cmTarget& t);
+                       const char* libname, cmTarget& t);
   void OutputLibraries(std::ostream& fout,
   void OutputLibraries(std::ostream& fout,
                        const char* configName,
                        const char* configName,
                        const char* libName,
                        const char* libName,
-                       const cmTarget &target);
+                       cmTarget &target);
   void OutputLibraryDirectories(std::ostream& fout,
   void OutputLibraryDirectories(std::ostream& fout,
                                 const char* configName,
                                 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,
   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, 
   void WriteVCProjBeginGroup(std::ostream& fout, 
                           const char* group,
                           const char* group,
                           const char* filter);
                           const char* filter);

+ 3 - 3
Source/cmMakeDepend.cxx

@@ -49,7 +49,7 @@ cmMakeDepend::~cmMakeDepend()
 // The pointer is kept so the cmSourceFile array can
 // The pointer is kept so the cmSourceFile array can
 // be updated with the depend information in the cmMakefile.
 // be updated with the depend information in the cmMakefile.
 
 
-void cmMakeDepend::SetMakefile(const cmMakefile* makefile)
+void cmMakeDepend::SetMakefile(cmMakefile* makefile)
 {
 {
   m_Makefile = makefile;
   m_Makefile = makefile;
 
 
@@ -264,8 +264,8 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file,
 void cmMakeDepend::GenerateMakefileDependencies()
 void cmMakeDepend::GenerateMakefileDependencies()
 {
 {
   // Now create cmDependInformation objects for files in the directory
   // 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++)
       l != tgts.end(); l++)
     {
     {
     const std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles();
     const std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles();

+ 2 - 2
Source/cmMakeDepend.h

@@ -94,7 +94,7 @@ public:
   /** 
   /** 
    * Set the makefile that is used as a source of classes.
    * 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
    * Get the depend info struct for a source file
@@ -153,7 +153,7 @@ protected:
    */
    */
   std::string FullPath(const char *filename, const char *extraPath);
   std::string FullPath(const char *filename, const char *extraPath);
 
 
-  const cmMakefile* m_Makefile;
+  cmMakefile* m_Makefile;
   bool m_Verbose;
   bool m_Verbose;
   cmsys::RegularExpression m_IncludeFileRegularExpression;
   cmsys::RegularExpression m_IncludeFileRegularExpression;
   cmsys::RegularExpression m_ComplainFileRegularExpression;
   cmsys::RegularExpression m_ComplainFileRegularExpression;

+ 6 - 45
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
 // call print on all the classes in the makefile
-void cmMakefile::Print() const
+void cmMakefile::Print()
 {
 {
   // print the class lists
   // print the class lists
   std::cout << "classes:\n";
   std::cout << "classes:\n";
 
 
   std::cout << " m_Targets: ";
   std::cout << " m_Targets: ";
-  for (cmTargets::const_iterator l = m_Targets.begin();
+  for (cmTargets::iterator l = m_Targets.begin();
        l != m_Targets.end(); l++)
        l != m_Targets.end(); l++)
     {
     {
     std::cout << l->first << std::endl;
     std::cout << l->first << std::endl;
@@ -1078,10 +1078,10 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
   target.ClearDependencyInformation( *this, lname );
   target.ClearDependencyInformation( *this, lname );
   target.SetInAll(true);
   target.SetInAll(true);
   target.GetSourceLists() = srcs;
   target.GetSourceLists() = srcs;
+  target.SetMakefile(this);
   this->AddGlobalLinkInformation(lname, target);
   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 
   // Add an entry into the cache 
   std::string libPath = lname;
   std::string libPath = lname;
   libPath += "_CMAKE_PATH";
   libPath += "_CMAKE_PATH";
@@ -1090,26 +1090,6 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
                   this->GetCurrentOutputDirectory(),
                   this->GetCurrentOutputDirectory(),
                   "Path to a library", cmCacheManager::INTERNAL);
                   "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
   // Add an entry into the cache
   std::string ltname = lname;
   std::string ltname = lname;
   ltname += "_LIBRARY_TYPE";
   ltname += "_LIBRARY_TYPE";
@@ -1150,30 +1130,11 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName,
   target.SetType(cmTarget::EXECUTABLE, exeName);
   target.SetType(cmTarget::EXECUTABLE, exeName);
   target.SetInAll(true);
   target.SetInAll(true);
   target.GetSourceLists() = srcs;
   target.GetSourceLists() = srcs;
+  target.SetMakefile(this);
   this->AddGlobalLinkInformation(exeName, target);
   this->AddGlobalLinkInformation(exeName, target);
   cmTargets::iterator it = 
   cmTargets::iterator it = 
     m_Targets.insert(cmTargets::value_type(exeName,target)).first;
     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 
   // Add an entry into the cache 
   std::string exePath = exeName;
   std::string exePath = exeName;
   exePath += "_CMAKE_PATH";
   exePath += "_CMAKE_PATH";

+ 1 - 2
Source/cmMakefile.h

@@ -131,7 +131,7 @@ public:
   /**
   /**
    * Print the object state to std::cout.
    * Print the object state to std::cout.
    */
    */
-  void Print() const;
+  void Print();
 
 
   /** Add a custom command to the build.  */
   /** Add a custom command to the build.  */
   void AddCustomCommandToTarget(const char* target,
   void AddCustomCommandToTarget(const char* target,
@@ -417,7 +417,6 @@ public:
    * Get the list of targets
    * Get the list of targets
    */
    */
   cmTargets &GetTargets() { return m_Targets; }
   cmTargets &GetTargets() { return m_Targets; }
-  const cmTargets &GetTargets() const { return m_Targets; }
 
 
   cmTarget* FindTarget(const char* name);
   cmTarget* FindTarget(const char* name);
 
 

+ 1 - 1
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 
                                                 cmTarget::LinkLibraryType 
                                                 linktype,
                                                 linktype,
                                                 const char* targetLibrary)
                                                 const char* targetLibrary)

+ 1 - 1
Source/cmOrderLinkDirectories.h

@@ -49,7 +49,7 @@ class cmOrderLinkDirectories
 public:
 public:
   cmOrderLinkDirectories();
   cmOrderLinkDirectories();
   ///! set link information from the target
   ///! set link information from the target
-  void SetLinkInformation(const cmTarget&, cmTarget::LinkLibraryType,
+  void SetLinkInformation(cmTarget&, cmTarget::LinkLibraryType,
                           const char* targetLibrary);
                           const char* targetLibrary);
   ///! Compute the best order for -L paths from GetLinkLibraries
   ///! Compute the best order for -L paths from GetLinkLibraries
   bool DetermineLibraryPathOrder();
   bool DetermineLibraryPathOrder();

+ 61 - 17
Source/cmTarget.cxx

@@ -554,14 +554,14 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
 
 
 void cmTarget::InsertDependency( DependencyMap& depMap,
 void cmTarget::InsertDependency( DependencyMap& depMap,
                                  const cmStdString& lib,
                                  const cmStdString& lib,
-                                 const cmStdString& dep ) const
+                                 const cmStdString& dep ) 
 {
 {
   depMap[lib].push_back(dep);
   depMap[lib].push_back(dep);
 }
 }
 
 
 void cmTarget::DeleteDependency( DependencyMap& depMap,
 void cmTarget::DeleteDependency( DependencyMap& depMap,
                                  const cmStdString& lib,
                                  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
   // 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
   // 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,
                      const DependencyMap& dep_map,
                      std::set<cmStdString>& emitted,
                      std::set<cmStdString>& emitted,
                      std::set<cmStdString>& visited,
                      std::set<cmStdString>& visited,
-                     std::vector<std::string>& link_line ) const
+                     std::vector<std::string>& link_line )
 {
 {
   // It's already been emitted
   // It's already been emitted
   if( emitted.find(lib) != emitted.end() )
   if( emitted.find(lib) != emitted.end() )
@@ -691,8 +691,52 @@ void cmTarget::SetProperty(const char* prop, const char* value)
   m_Properties[prop] = 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 = 
   std::map<cmStdString,cmStdString>::const_iterator i = 
     m_Properties.find(prop);
     m_Properties.find(prop);
   if (i != m_Properties.end())
   if (i != m_Properties.end())
@@ -702,7 +746,7 @@ const char *cmTarget::GetProperty(const char* prop) const
   return 0;
   return 0;
 }
 }
 
 
-bool cmTarget::GetPropertyAsBool(const char* prop) const
+bool cmTarget::GetPropertyAsBool(const char* prop)
 {
 {
   std::map<cmStdString,cmStdString>::const_iterator i = 
   std::map<cmStdString,cmStdString>::const_iterator i = 
     m_Properties.find(prop);
     m_Properties.find(prop);
@@ -713,7 +757,7 @@ bool cmTarget::GetPropertyAsBool(const char* prop) const
   return false;
   return false;
 }
 }
 
 
-const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg) const
+const char* cmTarget::GetLinkerLanguage(cmGlobalGenerator* gg)
 {
 {
   if(this->GetProperty("HAS_CXX"))
   if(this->GetProperty("HAS_CXX"))
     {
     {
@@ -795,12 +839,12 @@ const char* cmTarget::GetCreateRuleVariable()
   return "";
   return "";
 }
 }
 
 
-const char* cmTarget::GetSuffixVariable() const
+const char* cmTarget::GetSuffixVariable() 
 {
 {
   return this->GetSuffixVariableInternal(this->GetType());
   return this->GetSuffixVariableInternal(this->GetType());
 }
 }
 
 
-const char* cmTarget::GetSuffixVariableInternal(TargetType type) const
+const char* cmTarget::GetSuffixVariableInternal(TargetType type) 
 {
 {
   switch(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());
   return this->GetPrefixVariableInternal(this->GetType());
 }
 }
 
 
-const char* cmTarget::GetPrefixVariableInternal(TargetType type) const
+const char* cmTarget::GetPrefixVariableInternal(TargetType type) 
 {
 {
   switch(type)
   switch(type)
     {
     {
@@ -846,13 +890,13 @@ const char* cmTarget::GetPrefixVariableInternal(TargetType type) const
   return "";
   return "";
 }
 }
 
 
-std::string cmTarget::GetFullName(cmMakefile* mf) const
+std::string cmTarget::GetFullName(cmMakefile* mf) 
 {
 {
   return this->GetFullNameInternal(mf, this->GetType());
   return this->GetFullNameInternal(mf, this->GetType());
 }
 }
 
 
 std::string cmTarget::GetFullNameInternal(cmMakefile* mf,
 std::string cmTarget::GetFullNameInternal(cmMakefile* mf,
-                                          TargetType type) const
+                                          TargetType type) 
 {
 {
   const char* targetPrefix = this->GetProperty("PREFIX");
   const char* targetPrefix = this->GetProperty("PREFIX");
   const char* targetSuffix = this->GetProperty("SUFFIX");
   const char* targetSuffix = this->GetProperty("SUFFIX");
@@ -896,13 +940,13 @@ std::string cmTarget::GetFullNameInternal(cmMakefile* mf,
   return name;
   return name;
 }
 }
 
 
-std::string cmTarget::GetBaseName(cmMakefile* mf) const
+std::string cmTarget::GetBaseName(cmMakefile* mf) 
 {
 {
   return this->GetBaseNameInternal(mf, this->GetType());
   return this->GetBaseNameInternal(mf, this->GetType());
 }
 }
 
 
 std::string
 std::string
-cmTarget::GetBaseNameInternal(cmMakefile* mf, TargetType type) const
+cmTarget::GetBaseNameInternal(cmMakefile* mf, TargetType type) 
 {
 {
   std::string pathPrefix = "";
   std::string pathPrefix = "";
 #ifdef __APPLE__
 #ifdef __APPLE__
@@ -942,7 +986,7 @@ void cmTarget::GetLibraryNames(cmMakefile* mf,
                                std::string& name,
                                std::string& name,
                                std::string& soName,
                                std::string& soName,
                                std::string& realName,
                                std::string& realName,
-                               std::string& baseName) const
+                               std::string& baseName) 
 {
 {
   // Get the names based on the real type of the library.
   // Get the names based on the real type of the library.
   this->GetLibraryNamesInternal(mf, name, soName, realName, this->GetType());
   this->GetLibraryNamesInternal(mf, name, soName, realName, this->GetType());
@@ -955,7 +999,7 @@ void cmTarget::GetLibraryCleanNames(cmMakefile* mf,
                                     std::string& staticName,
                                     std::string& staticName,
                                     std::string& sharedName,
                                     std::string& sharedName,
                                     std::string& sharedSOName,
                                     std::string& sharedSOName,
-                                    std::string& sharedRealName) const
+                                    std::string& sharedRealName) 
 {
 {
   // Get the name as if this were a static library.
   // Get the name as if this were a static library.
   std::string soName;
   std::string soName;
@@ -986,7 +1030,7 @@ void cmTarget::GetLibraryNamesInternal(cmMakefile* mf,
                                        std::string& name,
                                        std::string& name,
                                        std::string& soName,
                                        std::string& soName,
                                        std::string& realName,
                                        std::string& realName,
-                                       TargetType type) const
+                                       TargetType type) 
 {
 {
   // Construct the name of the soname flag variable for this language.
   // Construct the name of the soname flag variable for this language.
   const char* ll =
   const char* ll =

+ 38 - 37
Source/cmTarget.h

@@ -41,7 +41,7 @@ public:
   /**
   /**
    * Return the type of target.
    * Return the type of target.
    */
    */
-  TargetType GetType() const
+  TargetType GetType()
     {
     {
       return m_TargetType;
       return m_TargetType;
     }
     }
@@ -52,43 +52,36 @@ public:
   void SetType(TargetType f, const char* name);
   void SetType(TargetType f, const char* name);
 
 
   ///! Set/Get the name of the target
   ///! 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
    * 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
    * Get the list of the custom commands for this target
    */
    */
-  const std::vector<cmCustomCommand> &GetPreBuildCommands() const 
-    {return m_PreBuildCommands;}
   std::vector<cmCustomCommand> &GetPreBuildCommands() 
   std::vector<cmCustomCommand> &GetPreBuildCommands() 
     {return m_PreBuildCommands;}
     {return m_PreBuildCommands;}
-  const std::vector<cmCustomCommand> &GetPreLinkCommands() const 
-    {return m_PreLinkCommands;}
   std::vector<cmCustomCommand> &GetPreLinkCommands() 
   std::vector<cmCustomCommand> &GetPreLinkCommands() 
     {return m_PreLinkCommands;}
     {return m_PreLinkCommands;}
-  const std::vector<cmCustomCommand> &GetPostBuildCommands() const 
-    {return m_PostBuildCommands;}
   std::vector<cmCustomCommand> &GetPostBuildCommands() 
   std::vector<cmCustomCommand> &GetPostBuildCommands() 
     {return m_PostBuildCommands;}
     {return m_PostBuildCommands;}
 
 
   /**
   /**
    * Get the list of the source lists used by this target
    * 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;}
   std::vector<std::string> &GetSourceLists() {return m_SourceLists;}
   
   
   /**
   /**
    * Get the list of the source files used by this target
    * 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;}
   std::vector<cmSourceFile*> &GetSourceFiles() {return m_SourceFiles;}
 
 
   /**
   /**
@@ -96,7 +89,7 @@ public:
    */
    */
   enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
   enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
   typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
   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.
    * 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 );
   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);
   void AddLinkDirectory(const char* d);
 
 
@@ -120,14 +114,14 @@ public:
    * Set the path where this target should be installed. This is relative to
    * Set the path where this target should be installed. This is relative to
    * INSTALL_PREFIX
    * INSTALL_PREFIX
    */
    */
-  std::string GetInstallPath() const {return m_InstallPath;}
+  std::string GetInstallPath() {return m_InstallPath;}
   void SetInstallPath(const char *name) {m_InstallPath = name;}
   void SetInstallPath(const char *name) {m_InstallPath = name;}
   
   
   /**
   /**
    * Set the path where this target (if it has a runtime part) should be
    * Set the path where this target (if it has a runtime part) should be
    * installed. This is relative to INSTALL_PREFIX
    * 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;}
   void SetRuntimeInstallPath(const char *name) {m_RuntimeInstallPath = name;}
   
   
   /**
   /**
@@ -142,14 +136,14 @@ public:
    */
    */
   void AddUtility(const char* u) { m_Utilities.insert(u);}
   void AddUtility(const char* u) { m_Utilities.insert(u);}
   ///! Get the utilities used by this target
   ///! 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 );
   void AnalyzeLibDependencies( const cmMakefile& mf );
 
 
   ///! Set/Get a property of this target file
   ///! Set/Get a property of this target file
   void SetProperty(const char *prop, const char *value);
   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
    * 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);  
   void TraceVSDependencies(std::string projName, cmMakefile *mf);  
 
 
   ///! Return the prefered linker language for this target
   ///! 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, 
   ///! Return the rule variable used to create this type of target, 
   //  need to add CMAKE_(LANG) for full name.
   //  need to add CMAKE_(LANG) for full name.
   const char* GetCreateRuleVariable();
   const char* GetCreateRuleVariable();
   ///! Return the name of the variable to look up the target suffix
   ///! 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
   ///! 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
   /** Get the full name of the target according to the settings in the
       given makefile.  */
       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
   /** Get the base name (no suffix) of the target according to the
       settings in the given makefile.  */
       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
   /** Get the names of the library needed to generate a build rule
       that takes into account shared library version numbers.  This
       that takes into account shared library version numbers.  This
       should be called only on a library target.  */
       should be called only on a library target.  */
   void GetLibraryNames(cmMakefile* mf, std::string& name,
   void GetLibraryNames(cmMakefile* mf, std::string& name,
                        std::string& soName, std::string& realName,
                        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
   /** Get the names of the library used to remove existing copies of
       the library from the build tree either before linking or during
       the library from the build tree either before linking or during
@@ -191,7 +185,7 @@ public:
                             std::string& staticName,
                             std::string& staticName,
                             std::string& sharedName,
                             std::string& sharedName,
                             std::string& sharedSOName,
                             std::string& sharedSOName,
-                            std::string& sharedRealName) const;
+                            std::string& sharedRealName);
 private:
 private:
   /**
   /**
    * A list of direct dependencies. Use in conjunction with DependencyMap.
    * A list of direct dependencies. Use in conjunction with DependencyMap.
@@ -216,14 +210,14 @@ private:
    */
    */
   void InsertDependency( DependencyMap& depMap,
   void InsertDependency( DependencyMap& depMap,
                          const cmStdString& lib,
                          const cmStdString& lib,
-                         const cmStdString& dep ) const;
+                         const cmStdString& dep );
 
 
   /*
   /*
    * Deletes \a dep from the dependency list of \a lib.
    * Deletes \a dep from the dependency list of \a lib.
    */
    */
   void DeleteDependency( DependencyMap& depMap,
   void DeleteDependency( DependencyMap& depMap,
                          const cmStdString& lib,
                          const cmStdString& lib,
-                         const cmStdString& dep ) const;
+                         const cmStdString& dep );
 
 
   /**
   /**
    * Emits the library \a lib and all its dependencies into link_line.
    * Emits the library \a lib and all its dependencies into link_line.
@@ -237,7 +231,7 @@ private:
              const DependencyMap& dep_map,
              const DependencyMap& dep_map,
              std::set<cmStdString>& emitted,
              std::set<cmStdString>& emitted,
              std::set<cmStdString>& visited,
              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
    * 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,
   void GatherDependencies( const cmMakefile& mf, const std::string& lib,
                            DependencyMap& dep_map ); 
                            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,
   void GetLibraryNamesInternal(cmMakefile* mf,
                                std::string& name,
                                std::string& name,
                                std::string& soName,
                                std::string& soName,
                                std::string& realName,
                                std::string& realName,
-                               TargetType type) const;
+                               TargetType type);
+
+  // update the value of the LOCATION var
+  void UpdateLocation();
+  
 private:
 private:
   std::string m_Name;
   std::string m_Name;
   std::vector<cmCustomCommand> m_PreBuildCommands;
   std::vector<cmCustomCommand> m_PreBuildCommands;
@@ -271,6 +269,9 @@ private:
   std::set<cmStdString> m_Utilities;
   std::set<cmStdString> m_Utilities;
   bool m_RecordDependencies; 
   bool m_RecordDependencies; 
   std::map<cmStdString,cmStdString> m_Properties;
   std::map<cmStdString,cmStdString> m_Properties;
+  
+  // the Makefile that owns this target
+  cmMakefile *m_Makefile;
 };
 };
 
 
 typedef std::map<cmStdString,cmTarget> cmTargets;
 typedef std::map<cmStdString,cmTarget> cmTargets;