Browse Source

cmTarget: Use string API to add sources to cmTarget objects.

Continue to call GetOrCreateSource where necessary to create
cmSourceFile objects which have the GENERATED attribute set.
Stephen Kelly 12 years ago
parent
commit
26d494ba01

+ 1 - 1
Source/cmFLTKWrapUICommand.cxx

@@ -168,7 +168,7 @@ void cmFLTKWrapUICommand::FinalPass()
     for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
     for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
       {
       {
       this->Makefile->GetTargets()[this->Target]
       this->Makefile->GetTargets()[this->Target]
-        .AddSourceFile(this->GeneratedSourcesClasses[classNum]);
+        .AddSource(this->GeneratedSourcesClasses[classNum]->GetFullPath());
       }
       }
     }
     }
 }
 }

+ 2 - 1
Source/cmGlobalVisualStudio8Generator.cxx

@@ -16,6 +16,7 @@
 #include "cmVisualStudioWCEPlatformParser.h"
 #include "cmVisualStudioWCEPlatformParser.h"
 #include "cmake.h"
 #include "cmake.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratedFileStream.h"
+#include "cmSourceFile.h"
 
 
 static const char vs8generatorName[] = "Visual Studio 8 2005";
 static const char vs8generatorName[] = "Visual Studio 8 2005";
 
 
@@ -323,7 +324,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
        no_main_dependency, commandLines, "Checking Build System",
        no_main_dependency, commandLines, "Checking Build System",
        no_working_directory, true))
        no_working_directory, true))
     {
     {
-    tgt->AddSourceFile(file);
+    tgt->AddSource(file->GetFullPath());
     }
     }
   else
   else
     {
     {

+ 3 - 3
Source/cmGlobalXCodeGenerator.cxx

@@ -1260,7 +1260,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
   if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
   if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
     {
     {
     sf->SetProperty("LANGUAGE", llang.c_str());
     sf->SetProperty("LANGUAGE", llang.c_str());
-    cmtarget.AddSourceFile(sf);
+    cmtarget.AddSource(fname);
     }
     }
 }
 }
 
 
@@ -2934,8 +2934,8 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
       if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
       if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
         {
         {
         std::string plist = this->ComputeInfoPListLocation(cmtarget);
         std::string plist = this->ComputeInfoPListLocation(cmtarget);
-        cmSourceFile* sf = mf->GetOrCreateSource(plist.c_str(), true);
-        cmtarget.AddSourceFile(sf);
+        mf->GetOrCreateSource(plist, true);
+        cmtarget.AddSource(plist);
         }
         }
 
 
       std::vector<cmSourceFile*> classes;
       std::vector<cmSourceFile*> classes;

+ 2 - 2
Source/cmLocalGenerator.cxx

@@ -754,8 +754,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
     comment.c_str(),
     comment.c_str(),
     this->Makefile->GetStartOutputDirectory()
     this->Makefile->GetStartOutputDirectory()
     );
     );
-  target.Target->AddSourceFile
-    (this->Makefile->GetSource(targetFullPath));
+  this->Makefile->GetSource(targetFullPath);
+  target.Target->AddSource(targetFullPath);
 }
 }
 
 
 
 

+ 3 - 3
Source/cmLocalVisualStudio6Generator.cxx

@@ -253,9 +253,9 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
                                            makefileIn.c_str(), commandLines,
                                            makefileIn.c_str(), commandLines,
                                            comment.c_str(),
                                            comment.c_str(),
                                            no_working_directory, true);
                                            no_working_directory, true);
-  if(cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str()))
+  if(this->Makefile->GetSource(makefileIn.c_str()))
     {
     {
-    tgt.AddSourceFile(file);
+    tgt.AddSource(makefileIn);
     }
     }
   else
   else
     {
     {
@@ -591,7 +591,7 @@ cmLocalVisualStudio6Generator
        origCommand.GetCommandLines(), comment,
        origCommand.GetCommandLines(), comment,
        origCommand.GetWorkingDirectory().c_str()))
        origCommand.GetWorkingDirectory().c_str()))
     {
     {
-    target.AddSourceFile(outsf);
+    target.AddSource(outsf->GetFullPath());
     }
     }
 
 
   // Replace the dependencies with the output of this rule so that the
   // Replace the dependencies with the output of this rule so that the

+ 2 - 2
Source/cmLocalVisualStudio7Generator.cxx

@@ -117,7 +117,7 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
         {
         {
         if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
         if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
           {
           {
-          l->second.AddSourceFile(sf);
+          l->second.AddSource(sf->GetFullPath());
           }
           }
         }
         }
       }
       }
@@ -153,7 +153,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
            force.c_str(), no_depends, no_main_dependency,
            force.c_str(), no_depends, no_main_dependency,
            force_commands, " ", 0, true))
            force_commands, " ", 0, true))
         {
         {
-        tgt.AddSourceFile(file);
+        tgt.AddSource(file->GetFullPath());
         }
         }
       }
       }
     }
     }

+ 1 - 1
Source/cmMakefile.cxx

@@ -1182,7 +1182,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target,
       {
       {
       if (this->Targets.find(target) != this->Targets.end())
       if (this->Targets.find(target) != this->Targets.end())
         {
         {
-        this->Targets[target].AddSourceFile(sf);
+        this->Targets[target].AddSource(sf->GetFullPath());
         }
         }
       else
       else
         {
         {

+ 7 - 10
Source/cmQtAutoGenerators.cxx

@@ -187,13 +187,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
     mocCppFile += "/";
     mocCppFile += "/";
     mocCppFile += automocTargetName;
     mocCppFile += automocTargetName;
     mocCppFile += ".cpp";
     mocCppFile += ".cpp";
-    cmSourceFile* mocCppSource = makefile->GetOrCreateSource(
-                                                          mocCppFile,
-                                                          true);
+    makefile->GetOrCreateSource(mocCppFile, true);
     makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
     makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
                             mocCppFile.c_str(), false);
                             mocCppFile.c_str(), false);
 
 
-    target->AddSourceFile(mocCppSource);
+    target->AddSource(mocCppFile);
     }
     }
   // create a custom target for running generators at buildtime:
   // create a custom target for running generators at buildtime:
   std::string autogenTargetName = getAutogenTargetName(target);
   std::string autogenTargetName = getAutogenTargetName(target);
@@ -479,7 +477,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
   const char *skipMocSep = "";
   const char *skipMocSep = "";
   const char *skipUicSep = "";
   const char *skipUicSep = "";
 
 
-  std::vector<cmSourceFile*> newRccFiles;
+  std::vector<std::string> newRccFiles;
 
 
   for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
   for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
       fileIt != srcFiles.end();
       fileIt != srcFiles.end();
@@ -512,9 +510,8 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
         rcc_output_file += "/qrc_" + basename + ".cpp";
         rcc_output_file += "/qrc_" + basename + ".cpp";
         makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
         makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
                                 rcc_output_file.c_str(), false);
                                 rcc_output_file.c_str(), false);
-        cmSourceFile* rccCppSource
-                = makefile->GetOrCreateSource(rcc_output_file, true);
-        newRccFiles.push_back(rccCppSource);
+        makefile->GetOrCreateSource(rcc_output_file, true);
+        newRccFiles.push_back(rcc_output_file);
         }
         }
       }
       }
 
 
@@ -546,11 +543,11 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
       }
       }
     }
     }
 
 
-  for(std::vector<cmSourceFile*>::const_iterator fileIt = newRccFiles.begin();
+  for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
       fileIt != newRccFiles.end();
       fileIt != newRccFiles.end();
       ++fileIt)
       ++fileIt)
     {
     {
-    const_cast<cmTarget*>(target)->AddSourceFile(*fileIt);
+    const_cast<cmTarget*>(target)->AddSource(*fileIt);
     }
     }
 }
 }