[Cmake-commits] [cmake-commits] hoffman committed cmCTest.cxx 1.359 1.360 cmGlobalVisualStudio10Generator.cxx 1.1 1.2 cmGlobalVisualStudio10Generator.h 1.2 1.3 cmGlobalVisualStudio71Generator.cxx 1.52 1.53 cmGlobalVisualStudio7Generator.cxx 1.105 1.106 cmGlobalVisualStudio7Generator.h 1.47 1.48 cmGlobalVisualStudioGenerator.cxx 1.14 1.15 cmLocalVisualStudio10Generator.cxx 1.1 1.2 cmLocalVisualStudio7Generator.cxx 1.246 1.247 cmLocalVisualStudio7Generator.h 1.55 1.56 cmLocalVisualStudioGenerator.cxx 1.17 1.18 cmLocalVisualStudioGenerator.h 1.10 1.11 cmTarget.cxx 1.260 1.261 cmVisualStudio10TargetGenerator.cxx 1.7 1.8 cmVisualStudio10TargetGenerator.h 1.3 1.4

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jul 10 09:12:41 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv16593/Source

Modified Files:
	cmCTest.cxx cmGlobalVisualStudio10Generator.cxx 
	cmGlobalVisualStudio10Generator.h 
	cmGlobalVisualStudio71Generator.cxx 
	cmGlobalVisualStudio7Generator.cxx 
	cmGlobalVisualStudio7Generator.h 
	cmGlobalVisualStudioGenerator.cxx 
	cmLocalVisualStudio10Generator.cxx 
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h 
	cmLocalVisualStudioGenerator.cxx 
	cmLocalVisualStudioGenerator.h cmTarget.cxx 
	cmVisualStudio10TargetGenerator.cxx 
	cmVisualStudio10TargetGenerator.h 
Log Message:
ENH: only 5 failing tests for VS 10


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.246
retrieving revision 1.247
diff -C 2 -d -r1.246 -r1.247
*** cmLocalVisualStudio7Generator.cxx	8 Jul 2009 17:04:02 -0000	1.246
--- cmLocalVisualStudio7Generator.cxx	10 Jul 2009 13:12:35 -0000	1.247
***************
*** 1406,1409 ****
--- 1406,1441 ----
  }
  
+ 
+ void cmLocalVisualStudio7Generator
+ ::ComputeMaxDirectoryLength(std::string& maxdir,
+   cmTarget& target)
+ {  
+   std::vector<std::string> *configs =
+     static_cast<cmGlobalVisualStudio7Generator *>
+     (this->GlobalGenerator)->GetConfigurations();
+   // Compute the maximum length configuration name.
+   std::string config_max;
+   for(std::vector<std::string>::iterator i = configs->begin();
+       i != configs->end(); ++i)
+     {
+     if(i->size() > config_max.size())
+       {
+       config_max = *i;
+       }
+     }
+ 
+   // Compute the maximum length full path to the intermediate
+   // files directory for any configuration.  This is used to construct
+   // object file names that do not produce paths that are too long.
+   std::string dir_max;
+   dir_max += this->Makefile->GetCurrentOutputDirectory();
+   dir_max += "/";
+   dir_max += this->GetTargetDirectory(target);
+   dir_max += "/";
+   dir_max += config_max;
+   dir_max += "/";
+   maxdir = dir_max;
+ }
+ 
  void cmLocalVisualStudio7Generator
  ::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
***************
*** 1426,1450 ****
      }
  
-   // Compute the maximum length configuration name.
-   std::string config_max;
-   for(std::vector<std::string>::iterator i = configs->begin();
-       i != configs->end(); ++i)
-     {
-     if(i->size() > config_max.size())
-       {
-       config_max = *i;
-       }
-     }
- 
    // Compute the maximum length full path to the intermediate
    // files directory for any configuration.  This is used to construct
    // object file names that do not produce paths that are too long.
    std::string dir_max;
!   dir_max += this->Makefile->GetCurrentOutputDirectory();
!   dir_max += "/";
!   dir_max += this->GetTargetDirectory(target);
!   dir_max += "/";
!   dir_max += config_max;
!   dir_max += "/";
  
    // Loop through each source in the source group.
--- 1458,1466 ----
      }
  
    // Compute the maximum length full path to the intermediate
    // files directory for any configuration.  This is used to construct
    // object file names that do not produce paths that are too long.
    std::string dir_max;
!   this->ComputeMaxDirectoryLength(dir_max, target);
  
    // Loop through each source in the source group.

Index: cmLocalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmLocalVisualStudioGenerator.cxx	16 Jun 2009 15:44:07 -0000	1.17
--- cmLocalVisualStudioGenerator.cxx	10 Jul 2009 13:12:37 -0000	1.18
***************
*** 27,30 ****
--- 27,31 ----
    this->WindowsShell = true;
    this->WindowsVSIDE = true;
+   this->NeedXMLEscape = false;
  }
  
***************
*** 232,237 ****
        else
          {
!         script += this->EscapeForShell(commandLine[j].c_str(),
                                         escapeAllowMakeVars);
          }
        }
--- 233,256 ----
        else
          {
!         if(this->NeedXMLEscape)
!           {
!           std::string arg = commandLine[j];
!           cmSystemTools::ReplaceString(arg, "&", "&amp;");
!           cmSystemTools::ReplaceString(arg, "<", "&lt;");
!           cmSystemTools::ReplaceString(arg, ">", "&gt;");
!           if(arg.find(" ") != arg.npos)
!             {
!             std::string q("\"");
!             arg = q + arg +q;
!             }
!           script += arg;
!           //script += this->EscapeForShell(arg.c_str(),
!           //escapeAllowMakeVars);
!           }
!         else
!           {
!           script += this->EscapeForShell(commandLine[j].c_str(),
                                         escapeAllowMakeVars);
+           }
          }
        }

Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C 2 -d -r1.55 -r1.56
*** cmLocalVisualStudio7Generator.h	25 Jun 2009 20:41:55 -0000	1.55
--- cmLocalVisualStudio7Generator.h	10 Jul 2009 13:12:36 -0000	1.56
***************
*** 73,80 ****
--- 73,85 ----
    cmSourceFile* CreateVCProjBuildRule();
    void WriteStampFiles();
+   void ComputeMaxDirectoryLength(std::string& maxdir,
+                                  cmTarget& target);
  
  private:
    typedef cmLocalVisualStudio7GeneratorOptions Options;
    typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
+   // Compute the maximum length full path to the intermediate
+   // files directory for any configuration.  This is used to construct
+   // object file names that do not produce paths that are too long.
    void ReadAndStoreExternalGUID(const char* name,
                                  const char* path);

Index: cmGlobalVisualStudio10Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio10Generator.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmGlobalVisualStudio10Generator.cxx	25 Jun 2009 20:41:55 -0000	1.1
--- cmGlobalVisualStudio10Generator.cxx	10 Jul 2009 13:12:25 -0000	1.2
***************
*** 97,98 ****
--- 97,159 ----
    return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
  }
+ 
+ 
+ std::string cmGlobalVisualStudio10Generator
+ ::GenerateBuildCommand(const char* makeProgram,
+                        const char *projectName, 
+                        const char* additionalOptions, const char *targetName,
+                        const char* config, bool ignoreErrors, bool)
+ {
+   // Ingoring errors is not implemented in visual studio 6
+   (void) ignoreErrors;
+ 
+   
+   // now build the test
+   std::string makeCommand 
+     = cmSystemTools::ConvertToOutputPath(makeProgram);
+   std::string lowerCaseCommand = makeCommand;
+   cmSystemTools::LowerCase(lowerCaseCommand);
+ 
+   // if there are spaces in the makeCommand, assume a full path
+   // and convert it to a path with no spaces in it as the
+   // RunSingleCommand does not like spaces
+   if(makeCommand.find(' ') != std::string::npos)
+     {
+     cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand);
+     }
+   // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
+   if(!targetName || strlen(targetName) == 0)
+     {
+     targetName = "ALL_BUILD";
+     }    
+   bool clean = false;
+   if ( targetName && strcmp(targetName, "clean") == 0 )
+     {
+     clean = true;
+     makeCommand += " ";
+     makeCommand += projectName;
+     makeCommand += ".sln ";
+     makeCommand += "/t:Clean ";
+     }
+   else
+     {
+     makeCommand += " ";
+     makeCommand += targetName;
+     makeCommand += ".vcxproj ";
+     }
+   makeCommand += "/p:Configuration=";
+   if(config && strlen(config))
+     {
+     makeCommand += config;
+     }
+   else
+     {
+     makeCommand += "Debug";
+     }
+   if ( additionalOptions )
+     {
+     makeCommand += " ";
+     makeCommand += additionalOptions;
+     }
+   return makeCommand;
+ }

Index: cmGlobalVisualStudio10Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio10Generator.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmGlobalVisualStudio10Generator.h	26 Jun 2009 15:50:07 -0000	1.2
--- cmGlobalVisualStudio10Generator.h	10 Jul 2009 13:12:27 -0000	1.3
***************
*** 34,37 ****
--- 34,43 ----
      return new cmGlobalVisualStudio10Generator; }
    
+   virtual std::string 
+   GenerateBuildCommand(const char* makeProgram,
+                        const char *projectName, 
+                        const char* additionalOptions, const char *targetName,
+                        const char* config, bool ignoreErrors, bool);
+   
    ///! Get the name for the generator.
    virtual const char* GetName() const {

Index: cmVisualStudio10TargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C 2 -d -r1.3 -r1.4
*** cmVisualStudio10TargetGenerator.h	28 Jun 2009 13:46:25 -0000	1.3
--- cmVisualStudio10TargetGenerator.h	10 Jul 2009 13:12:39 -0000	1.4
***************
*** 71,75 ****
--- 71,81 ----
    void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
    void WriteLibOptions(std::string const& config);
+   void WriteEvents(std::string const& configName);
+   void WriteEvent(const char* name, std::vector<cmCustomCommand> & commands,
+                   std::string const& configName);
+   void ComputeObjectNames();
  private:
+   std::string ModuleDefinitionFile;
+   std::string PathToVcxproj;
    cmTarget* Target;
    cmMakefile* Makefile;

Index: cmGlobalVisualStudio71Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio71Generator.cxx,v
retrieving revision 1.52
retrieving revision 1.53
diff -C 2 -d -r1.52 -r1.53
*** cmGlobalVisualStudio71Generator.cxx	25 Jun 2009 20:41:55 -0000	1.52
--- cmGlobalVisualStudio71Generator.cxx	10 Jul 2009 13:12:27 -0000	1.53
***************
*** 117,122 ****
                        root, generators);
    OrderedTargetDependSet orderedProjectTargets(projectTargets);
!   this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
!                                originalTargets);
    // Write out the configurations information for the solution
    fout << "Global\n";
--- 117,121 ----
                        root, generators);
    OrderedTargetDependSet orderedProjectTargets(projectTargets);
!   this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
    // Write out the configurations information for the solution
    fout << "Global\n";
***************
*** 258,262 ****
                         const std::vector<std::string>& depends)
  { 
-   std::cout << "WriteExternalProject vs71\n";
    fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
         << name << "\", \""
--- 257,260 ----

Index: cmLocalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** cmLocalVisualStudioGenerator.h	25 Jun 2009 20:41:55 -0000	1.10
--- cmLocalVisualStudioGenerator.h	10 Jul 2009 13:12:38 -0000	1.11
***************
*** 57,62 ****
    void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups,
                               std::map<cmStdString, int>& count);
! 
    std::set<const cmSourceFile*> NeedObjectName;
  };
  
--- 57,63 ----
    void InsertNeedObjectNames(const std::vector<cmSourceGroup>& groups,
                               std::map<cmStdString, int>& count);
!   bool NeedXMLEscape;
    std::set<const cmSourceFile*> NeedObjectName;
+   friend class cmVisualStudio10TargetGenerator;
  };
  

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.105
retrieving revision 1.106
diff -C 2 -d -r1.105 -r1.106
*** cmGlobalVisualStudio7Generator.cxx	21 Jan 2009 22:24:54 -0000	1.105
--- cmGlobalVisualStudio7Generator.cxx	10 Jul 2009 13:12:28 -0000	1.106
***************
*** 195,199 ****
    // Now write out the DSW
    this->OutputSLNFile();
- 
    // If any solution or project files changed during the generation,
    // tell Visual Studio to reload them...
--- 195,198 ----
***************
*** 241,262 ****
  
  
- void cmGlobalVisualStudio7Generator::AddAllBuildDepends(
-   cmLocalGenerator* root,
-   cmTarget* target,
-   cmGlobalGenerator::TargetDependSet& originalTargets)
- {
-   // if this is the special ALL_BUILD utility, then
-   // make it depend on every other non UTILITY project.
-   for(cmGlobalGenerator::TargetDependSet::iterator ot =
-         originalTargets.begin(); ot != originalTargets.end(); ++ot)
-     {
-     cmTarget* t = const_cast<cmTarget*>(*ot);
-     if(!this->IsExcluded(root, *t))
-       {
-       target->AddUtility(t->GetName());
-       }
-     }
- }
- 
  void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
    std::ostream& fout, 
--- 240,243 ----
***************
*** 297,303 ****
      std::ostream& fout,
      cmLocalGenerator* root,
!     OrderedTargetDependSet const& projectTargets,
!     cmGlobalGenerator::TargetDependSet& originalTargets
!     )
  {
    std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
--- 278,282 ----
      std::ostream& fout,
      cmLocalGenerator* root,
!     OrderedTargetDependSet const& projectTargets)
  {
    std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
***************
*** 307,318 ****
      {
      cmTarget* target = *tt;
-     cmMakefile* mf = target->GetMakefile();
-     // look for the all_build rule and add depends to all
-     // of the original targets (none that were "pulled" into this project)
-     if(mf == root->GetMakefile() &&
-        strcmp(target->GetName(), "ALL_BUILD") == 0)
-       {
-       this->AddAllBuildDepends(root, target, originalTargets);
-       }
      // handle external vc project files
      if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
--- 286,289 ----
***************
*** 428,433 ****
                        root, generators);
    OrderedTargetDependSet orderedProjectTargets(projectTargets);
!   this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
!                                originalTargets);
    // Write out the configurations information for the solution
    fout << "Global\n"
--- 399,403 ----
                        root, generators);
    OrderedTargetDependSet orderedProjectTargets(projectTargets);
!   this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
    // Write out the configurations information for the solution
    fout << "Global\n"
***************
*** 595,599 ****
                                 const std::vector<std::string>&)
  { 
-   std::cout << "WriteExternalProject vs7\n";
    std::string d = cmSystemTools::ConvertToOutputPath(location);
    fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" 
--- 565,568 ----

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.359
retrieving revision 1.360
diff -C 2 -d -r1.359 -r1.360
*** cmCTest.cxx	11 May 2009 17:58:19 -0000	1.359
--- cmCTest.cxx	10 Jul 2009 13:12:24 -0000	1.360
***************
*** 2768,2772 ****
  {
    std::string test_outputs("\n*** Test Failed:\n");
!   test_outputs.append(&*process_output.begin(), process_output.size());
    cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
  }
--- 2768,2775 ----
  {
    std::string test_outputs("\n*** Test Failed:\n");
!   if(process_output.size())
!     {
!     test_outputs.append(&*process_output.begin(), process_output.size());
!     }
    cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
  }

Index: cmVisualStudio10TargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmVisualStudio10TargetGenerator.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmVisualStudio10TargetGenerator.cxx	8 Jul 2009 17:04:04 -0000	1.7
--- cmVisualStudio10TargetGenerator.cxx	10 Jul 2009 13:12:38 -0000	1.8
***************
*** 44,51 ****
--- 44,57 ----
      this->Makefile->GetLocalGenerator();
    this->Platform = "|Win32";
+   this->ComputeObjectNames();
  }
  
  cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
  {
+   if (this->BuildFileStream->Close())
+     {
+     this->GlobalGenerator
+       ->FileReplacedDuringGenerate(this->PathToVcxproj);
+     }
    delete this->BuildFileStream;
  }
***************
*** 105,108 ****
--- 111,115 ----
    this->BuildFileStream =
      new cmGeneratedFileStream(path.c_str());
+   this->PathToVcxproj = path;
    this->BuildFileStream->SetCopyIfDifferent(true);
    
***************
*** 383,425 ****
  void cmVisualStudio10TargetGenerator::WriteCLSources()
  {
-   this->WriteString("<ItemGroup>\n", 1);
    if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
      {
!     this->WriteString("<None Include=\"", 2);
!     (*this->BuildFileStream ) << this->Target->GetDirectory()
!                               << "\\" << this->Target->GetName() 
!                               << "\" />\n";
      }
!   else
      {
!     std::vector<cmSourceFile*>const& sources = this->Target->GetSourceFiles();
!     for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
!         source != sources.end(); ++source)
        {
!       // if it is not a custom command then add it as a c/c++ file,
!       // TODO: need to check for idl or rc
!       if(!(*source)->GetCustomCommand()
!          && !(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
!          && !this->GlobalGenerator->IgnoreFile
!          ((*source)->GetExtension().c_str()))
          {
!         const char* lang = (*source)->GetLanguage();
!         if(lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0))
            {
!           std::string sourceFile = (*source)->GetFullPath();
!           // output the source file
!           this->WriteString("<ClCompile Include=\"", 2);
!           (*this->BuildFileStream ) << sourceFile << "\"";
!           // ouput any flags specific to this source file
!           if(this->OutputSourceSpecificFlags(*source))
!             {
!             // if the source file has specific flags the tag
!             // is ended on a new line
!             this->WriteString("</ClCompile>\n", 2);
!             }
!           else
!             {
!             (*this->BuildFileStream ) << " />\n";
!             }
            }
          }
--- 390,426 ----
  void cmVisualStudio10TargetGenerator::WriteCLSources()
  {
    if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
      {
!     return;
      }
!   this->WriteString("<ItemGroup>\n", 1);
!   std::vector<cmSourceFile*>const& sources = this->Target->GetSourceFiles();
!   for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
!       source != sources.end(); ++source)
      {
!     // if it is not a custom command then add it as a c/c++ file,
!     // TODO: need to check for idl or rc
!     if(!(*source)->GetCustomCommand()
!        && !(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
!        && !this->GlobalGenerator->IgnoreFile
!        ((*source)->GetExtension().c_str()))
        {
!       const char* lang = (*source)->GetLanguage();
!       if(lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0))
          {
!         std::string sourceFile = (*source)->GetFullPath();
!         // output the source file
!         this->WriteString("<ClCompile Include=\"", 2);
!         (*this->BuildFileStream ) << sourceFile << "\"";
!         // ouput any flags specific to this source file
!         if(this->OutputSourceSpecificFlags(*source))
            {
!           // if the source file has specific flags the tag
!           // is ended on a new line
!           this->WriteString("</ClCompile>\n", 2);
!           }
!         else
!           {
!           (*this->BuildFileStream ) << " />\n";
            }
          }
***************
*** 429,436 ****
  }
  
  bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
    cmSourceFile* source)
! {
    cmSourceFile& sf = *source;
    std::string flags;
    std::string defines;
--- 430,475 ----
  }
  
+ void cmVisualStudio10TargetGenerator::ComputeObjectNames()
+ {
+   // We may be modifying the source groups temporarily, so make a copy.
+   std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
+ 
+   // get the classes from the source lists then add them to the groups
+   std::vector<cmSourceFile*>const & classes = this->Target->GetSourceFiles();
+   for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
+       i != classes.end(); i++)
+     {
+     // Add the file to the list of sources.
+     std::string source = (*i)->GetFullPath();
+     if(cmSystemTools::UpperCase((*i)->GetExtension()) == "DEF")
+       {
+       this->ModuleDefinitionFile = (*i)->GetFullPath();
+       }
+     cmSourceGroup& sourceGroup =
+       this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+     sourceGroup.AssignSource(*i);
+     }
+ 
+   // Compute which sources need unique object computation.
+   this->LocalGenerator->ComputeObjectNameRequirements(sourceGroups);
+ }
+ 
  bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
    cmSourceFile* source)
! { 
    cmSourceFile& sf = *source;
+   cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+ 
+   // Compute the maximum length full path to the intermediate
+   // files directory for any configuration.  This is used to construct
+   // object file names that do not produce paths that are too long.
+   std::string dir_max;
+   lg->ComputeMaxDirectoryLength(dir_max, *this->Target);
+ 
+   std::string objectName;
+   if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end())
+     {
+     objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max);
+     }
    std::string flags;
    std::string defines;
***************
*** 471,481 ****
        }
      }
    // for the first time we need a new line if there is something
    // produced here.
    const char* firstString = ">\n";
    std::vector<std::string> *configs =
      static_cast<cmGlobalVisualStudio7Generator *>
      (this->GlobalGenerator)->GetConfigurations();
-   bool hasFlags = false;
    for( std::vector<std::string>::iterator config = configs->begin();
         config != configs->end(); ++config)
--- 510,529 ----
        }
      }
+   bool hasFlags = false;
    // for the first time we need a new line if there is something
    // produced here.
    const char* firstString = ">\n";
+   if(objectName.size())
+     {
+     (*this->BuildFileStream ) << firstString;
+     firstString = ""; 
+     hasFlags = true;
+     this->WriteString("<ObjectFileName>", 3);
+     (*this->BuildFileStream )
+       << "$(Configuration)/" << objectName << "</ObjectFileName>\n";
+     }
    std::vector<std::string> *configs =
      static_cast<cmGlobalVisualStudio7Generator *>
      (this->GlobalGenerator)->GetConfigurations();
    for( std::vector<std::string>::iterator config = configs->begin();
         config != configs->end(); ++config)
***************
*** 520,523 ****
--- 568,575 ----
  void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
  {
+   if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
+     {
+     return;
+     }
    this->WriteString("<PropertyGroup>\n", 2);
    this->WriteString("<_ProjectFileVersion>10.0.20506.1"
***************
*** 673,676 ****
--- 725,734 ----
        }
      }
+   // Add the target-specific flags.
+   if(const char* targetFlags = this->Target->GetProperty("COMPILE_FLAGS"))
+     {
+     flags += " ";
+     flags += targetFlags;
+     }
    std::string configUpper = cmSystemTools::UpperCase(configName);
    std::string defPropName = "COMPILE_DEFINITIONS_";
***************
*** 878,883 ****
--- 936,946 ----
        d != ldirs.end(); ++d)
      {
+     // first just full path
      linkDirs += sep;
      linkDirs += *d;
+     linkDirs += sep;
+     // next path with configuration type Debug, Release, etc
+     linkDirs += *d;
+     linkDirs += "/$(Configuration)";
      sep = ";";
      }
***************
*** 911,917 ****
                                    config.c_str());
      }
!   std::string dir = this->Target->GetDirectory(config.c_str());
    dir += "/";
!   std::string imLib = dir;
    imLib += targetNameImport;
    std::string pdb = dir;
--- 974,981 ----
                                    config.c_str());
      }
!   std::string imLib = this->Target->GetDirectory(config.c_str(), true);
!   std::string dir = this->Target->GetDirectory(config.c_str(), true);
    dir += "/";
!   imLib += "/";
    imLib += targetNameImport;
    std::string pdb = dir;
***************
*** 998,1001 ****
--- 1062,1067 ----
      //    output midl flags       <Midl></Midl>
      this->WriteMidlOptions(*i, includes);
+     // write events
+     this->WriteEvents(*i);
      //    output link flags       <Link></Link> 
      this->WriteLinkOptions(*i);
***************
*** 1006,1020 ****
  }
  
  
  void cmVisualStudio10TargetGenerator::WriteProjectReferences()
  {
!   // TODO
!   // This should have dependent targets listed like this:
!   /*
!  <ItemGroup>
!     <ProjectReference Include="ZERO_CHECK.vcxproj">
!       <Project>{2f1e4f3c-0a51-46c3-aaf9-e486599604f2}</Project>
!     </ProjectReference>
!   </ItemGroup>
!   */
  }
--- 1072,1148 ----
  }
  
+ void 
+ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
+ {
+   this->WriteEvent("PreLinkEvent",
+                    this->Target->GetPreLinkCommands(), configName);
+   this->WriteEvent("PreBuildEvent",
+                    this->Target->GetPreBuildCommands(), configName);
+   this->WriteEvent("PostBuildEvent",
+                    this->Target->GetPostBuildCommands(), configName);
+ }
+ 
+ void cmVisualStudio10TargetGenerator::WriteEvent(
+   const char* name,
+   std::vector<cmCustomCommand> & commands,
+   std::string const& configName)
+ {
+   if(commands.size() == 0)
+     {
+     return;
+     }
+   this->WriteString("<", 2);
+   (*this->BuildFileStream ) << name << ">\n";
+   cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
+   std::string script;
+   const char* pre = "";
+   std::string comment;
+   for(std::vector<cmCustomCommand>::iterator i = commands.begin();
+       i != commands.end(); ++i)
+     {  
+     cmCustomCommand& command = *i;
+     comment += pre;
+     comment += lg->ConstructComment(command);
+     script += pre;
+     pre = "\n";
+     script += 
+       lg->ConstructScript(command.GetCommandLines(),
+                           command.GetWorkingDirectory(),
+                           configName.c_str(),
+                           command.GetEscapeOldStyle(),
+                           command.GetEscapeAllowMakeVars());
+     }
+   this->WriteString("<Message>",3);
+   (*this->BuildFileStream ) << comment << "</Message>\n";
+   this->WriteString("<Command>", 3);
+   (*this->BuildFileStream ) << script;
+   (*this->BuildFileStream ) << "</Command>" << "\n";
+   this->WriteString("</", 2);
+   (*this->BuildFileStream ) << name << ">\n";
+ }
+ 
  
  void cmVisualStudio10TargetGenerator::WriteProjectReferences()
  {
!   cmGlobalGenerator::TargetDependSet& depends
!     = this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
!   this->WriteString("<ItemGroup>\n", 1);
!   for( cmGlobalGenerator::TargetDependSet::const_iterator i = depends.begin();
!        i != depends.end(); ++i)
!     {
!     cmTarget* dt = *i;
!     this->WriteString("<ProjectReference Include=\"", 2);
!     cmMakefile* mf = dt->GetMakefile();
!     std::string path =  mf->GetStartOutputDirectory();
!     path += "/";
!     path += dt->GetName();
!     path += ".vcxproj";
!     (*this->BuildFileStream) << path << "\">\n";
!     this->WriteString("<Project>", 3);
!     (*this->BuildFileStream) 
!       << this->GlobalGenerator->GetGUID(dt->GetName())
!       << "</Project>\n";
!     this->WriteString("</ProjectReference>\n", 2);
!     }
!   this->WriteString("</ItemGroup>\n", 1);
  }

Index: cmGlobalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmGlobalVisualStudioGenerator.cxx	30 Jul 2008 19:26:34 -0000	1.14
--- cmGlobalVisualStudioGenerator.cxx	10 Jul 2009 13:12:32 -0000	1.15
***************
*** 49,56 ****
        // Use no actual command lines so that the target itself is not
        // considered always out of date.
!       gen[0]->GetMakefile()->
          AddUtilityCommand("ALL_BUILD", true, no_working_dir,
                            no_depends, no_commands, false,
                            "Build all projects");
        }
      }
--- 49,72 ----
        // Use no actual command lines so that the target itself is not
        // considered always out of date.
!       cmTarget* allBuild = 
!         gen[0]->GetMakefile()->
          AddUtilityCommand("ALL_BUILD", true, no_working_dir,
                            no_depends, no_commands, false,
                            "Build all projects");
+       // Now make all targets depend on the ALL_BUILD target
+       cmTargets targets;
+       for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
+           i != gen.end(); ++i)
+         {
+         cmTargets& targets = (*i)->GetMakefile()->GetTargets();
+         for(cmTargets::iterator t = targets.begin();
+             t != targets.end(); ++t)
+           {
+           if(!this->IsExcluded(gen[0], t->second))
+             {
+             allBuild->AddUtility(t->second.GetName());
+             }
+           }
+         }
        }
      }

Index: cmGlobalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C 2 -d -r1.47 -r1.48
*** cmGlobalVisualStudio7Generator.h	21 Jan 2009 22:36:06 -0000	1.47
--- cmGlobalVisualStudio7Generator.h	10 Jul 2009 13:12:29 -0000	1.48
***************
*** 129,134 ****
      std::ostream& fout,
      cmLocalGenerator* root,
!     OrderedTargetDependSet const& projectTargets,
!     cmGlobalGenerator::TargetDependSet& originalTargets);
    virtual void WriteTargetDepends(
      std::ostream& fout,
--- 129,133 ----
      std::ostream& fout,
      cmLocalGenerator* root,
!     OrderedTargetDependSet const& projectTargets);
    virtual void WriteTargetDepends(
      std::ostream& fout,
***************
*** 139,146 ****
      OrderedTargetDependSet const& projectTargets);
    
-   void AddAllBuildDepends(cmLocalGenerator* root,
-                           cmTarget* target,
-                           cmGlobalGenerator::TargetDependSet& targets);
-                                        
    void GenerateConfigurations(cmMakefile* mf);
  
--- 138,141 ----

Index: cmLocalVisualStudio10Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio10Generator.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmLocalVisualStudio10Generator.cxx	25 Jun 2009 20:41:55 -0000	1.1
--- cmLocalVisualStudio10Generator.cxx	10 Jul 2009 13:12:34 -0000	1.2
***************
*** 24,28 ****
  cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
  {
! 
  }
  
--- 24,28 ----
  cmLocalVisualStudio10Generator::cmLocalVisualStudio10Generator()
  {
!   this->NeedXMLEscape = true;
  }
  

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.260
retrieving revision 1.261
diff -C 2 -d -r1.260 -r1.261
*** cmTarget.cxx	8 Jul 2009 18:33:08 -0000	1.260
--- cmTarget.cxx	10 Jul 2009 13:12:38 -0000	1.261
***************
*** 1993,1996 ****
--- 1993,1997 ----
      msg += cmTarget::TargetTypeNames[this->GetType()];
      this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
+     abort();
      return 0;
      }



More information about the Cmake-commits mailing list