[Cmake-commits] [cmake-commits] david.cole committed cmGlobalVisualStudio6Generator.cxx 1.75 1.76 cmLocalVisualStudio6Generator.cxx 1.147 1.148 cmake.cxx 1.400 1.401

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Dec 9 16:07:12 EST 2008


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

Modified Files:
	cmGlobalVisualStudio6Generator.cxx 
	cmLocalVisualStudio6Generator.cxx cmake.cxx 
Log Message:
COMP: Fix the ExternalProject test for Visual Studio 6. Visual Studio 6 *.dsp files cannot have hyphens in them. Add utility function GetVS6TargetName to replace hyphens with underscores when generating *.dsp file names. Use the function everywhere necessary in the VS6 generators. And, a workaround: VS6 uses ".\Debug" (for example) as an "$(IntDir)" value - strip any leading ".\" when processing a --config argument in the cmake --build handling code.


Index: cmGlobalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio6Generator.cxx,v
retrieving revision 1.75
retrieving revision 1.76
diff -C 2 -d -r1.75 -r1.76
*** cmGlobalVisualStudio6Generator.cxx	28 Jan 2008 13:38:35 -0000	1.75
--- cmGlobalVisualStudio6Generator.cxx	9 Dec 2008 21:07:10 -0000	1.76
***************
*** 373,376 ****
--- 373,393 ----
  }
  
+ 
+ // Utility function to make a valid VS6 *.dsp filename out
+ // of a CMake target name:
+ //
+ std::string GetVS6TargetName(const std::string& targetName)
+ {
+   std::string name(targetName);
+ 
+   // Eliminate hyphens. VS6 cannot handle hyphens in *.dsp filenames...
+   // Replace them with underscores.
+   //
+   cmSystemTools::ReplaceString(name, "-", "_");
+ 
+   return name;
+ }
+ 
+ 
  // Write a dsp file into the DSW file,
  // Note, that dependencies from executables to 
***************
*** 403,407 ****
            {
            fout << "Begin Project Dependency\n";
!           fout << "Project_Dep_Name " << j->first.c_str() << "\n";
            fout << "End Project Dependency\n";
            }
--- 420,424 ----
            {
            fout << "Begin Project Dependency\n";
!           fout << "Project_Dep_Name " << GetVS6TargetName(j->first.c_str()) << "\n";
            fout << "End Project Dependency\n";
            }
***************
*** 420,424 ****
        std::string depName = this->GetUtilityForTarget(target, i->c_str());
        fout << "Begin Project Dependency\n";
!       fout << "Project_Dep_Name " << depName << "\n";
        fout << "End Project Dependency\n";
        }
--- 437,441 ----
        std::string depName = this->GetUtilityForTarget(target, i->c_str());
        fout << "Begin Project Dependency\n";
!       fout << "Project_Dep_Name " << GetVS6TargetName(depName) << "\n";
        fout << "End Project Dependency\n";
        }
***************
*** 452,456 ****
    {
      fout << "Begin Project Dependency\n";
!     fout << "Project_Dep_Name " << *i << "\n";
      fout << "End Project Dependency\n";
    }
--- 469,473 ----
    {
      fout << "Begin Project Dependency\n";
!     fout << "Project_Dep_Name " << GetVS6TargetName(*i) << "\n";
      fout << "End Project Dependency\n";
    }

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.400
retrieving revision 1.401
diff -C 2 -d -r1.400 -r1.401
*** cmake.cxx	15 Oct 2008 19:13:06 -0000	1.400
--- cmake.cxx	9 Dec 2008 21:07:10 -0000	1.401
***************
*** 4418,4421 ****
--- 4418,4429 ----
      return 1;
      }
+ 
+   // Hack for vs6 that passes ".\Debug" as "$(IntDir)" value:
+   //
+   if (cmSystemTools::StringStartsWith(config.c_str(), ".\\"))
+     {
+     config = config.substr(2);
+     }
+ 
    cmake cm;
    return cm.Build(dir, target, config, extraBuildOptions, clean);

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.147
retrieving revision 1.148
diff -C 2 -d -r1.147 -r1.148
*** cmLocalVisualStudio6Generator.cxx	8 Dec 2008 00:36:03 -0000	1.147
--- cmLocalVisualStudio6Generator.cxx	9 Dec 2008 21:07:10 -0000	1.148
***************
*** 64,68 ****
    // Setup /I and /LIBPATH options for the resulting DSP file.  VS 6
    // truncates long include paths so make it as short as possible if
!   // the length threatents this problem.
    unsigned int maxIncludeLength = 3000;
    bool useShortPath = false;
--- 64,68 ----
    // Setup /I and /LIBPATH options for the resulting DSP file.  VS 6
    // truncates long include paths so make it as short as possible if
!   // the length threatens this problem.
    unsigned int maxIncludeLength = 3000;
    bool useShortPath = false;
***************
*** 168,176 ****
  }
  
  void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, 
                                                      cmTarget &target)
  {
    // add to the list of projects
!   std::string pname = lname;
    this->CreatedProjectNames.push_back(pname);
    // create the dsp.cmake file
--- 168,182 ----
  }
  
+ // Utility function to make a valid VS6 *.dsp filename out
+ // of a CMake target name:
+ //
+ extern std::string GetVS6TargetName(const std::string& targetName);
+ 
  void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, 
                                                      cmTarget &target)
  {
    // add to the list of projects
!   std::string pname = GetVS6TargetName(lname);
! 
    this->CreatedProjectNames.push_back(pname);
    // create the dsp.cmake file
***************
*** 178,182 ****
    fname = this->Makefile->GetStartOutputDirectory();
    fname += "/";
!   fname += lname;
    fname += ".dsp";
    // save the name of the real dsp file
--- 184,188 ----
    fname = this->Makefile->GetStartOutputDirectory();
    fname += "/";
!   fname += pname;
    fname += ".dsp";
    // save the name of the real dsp file
***************
*** 189,193 ****
      cmSystemTools::ReportLastSystemError("");
      }
!   this->WriteDSPFile(fout,lname,target);
    fout.close();
    // if the dsp file has changed, then write it.
--- 195,199 ----
      cmSystemTools::ReportLastSystemError("");
      }
!   this->WriteDSPFile(fout,pname.c_str(),target);
    fout.close();
    // if the dsp file has changed, then write it.
***************
*** 198,202 ****
  void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
  {
!   std::string dspname = tgt.GetName();
    dspname += ".dsp.cmake";
    const char* dsprule = 
--- 204,208 ----
  void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
  {
!   std::string dspname = GetVS6TargetName(tgt.GetName());
    dspname += ".dsp.cmake";
    const char* dsprule = 
***************
*** 288,295 ****
      }
    
-   // trace the visual studio dependencies
-   std::string name = libName;
-   name += ".dsp.cmake";
- 
    // We may be modifying the source groups temporarily, so make a copy.
    std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
--- 294,297 ----
***************
*** 463,467 ****
        cmSystemTools::ExpandListArgument(dependsValue, depends);
        }
!     if (source != libName || target.GetType() == cmTarget::UTILITY ||
        target.GetType() == cmTarget::GLOBAL_TARGET)
        {
--- 465,470 ----
        cmSystemTools::ExpandListArgument(dependsValue, depends);
        }
!     if (GetVS6TargetName(source) != libName ||
!       target.GetType() == cmTarget::UTILITY ||
        target.GetType() == cmTarget::GLOBAL_TARGET)
        {
***************
*** 759,767 ****
    this->Configurations.erase(this->Configurations.begin(), 
                               this->Configurations.end());
    // now add all the configurations possible
    std::string line;
    while(cmSystemTools::GetLineFromStream(fin, line))
      {
!     cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
      if (reg.find(line))
        {
--- 762,772 ----
    this->Configurations.erase(this->Configurations.begin(), 
                               this->Configurations.end());
+ 
    // now add all the configurations possible
+   std::string vs6name = GetVS6TargetName(libName);
    std::string line;
    while(cmSystemTools::GetLineFromStream(fin, line))
      {
!     cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str());
      if (reg.find(line))
        {
***************
*** 1056,1061 ****
           && target.GetType() != cmTarget::STATIC_LIBRARY 
           && target.GetType() != cmTarget::MODULE_LIBRARY) || 
!         (target.GetType()==cmTarget::SHARED_LIBRARY && libName != j->first) ||
!         (target.GetType()==cmTarget::MODULE_LIBRARY && libName != j->first))
        {
        // Compute the proper name to use to link this library.
--- 1061,1066 ----
           && target.GetType() != cmTarget::STATIC_LIBRARY 
           && target.GetType() != cmTarget::MODULE_LIBRARY) || 
!         (target.GetType()==cmTarget::SHARED_LIBRARY && libName != GetVS6TargetName(j->first)) ||
!         (target.GetType()==cmTarget::MODULE_LIBRARY && libName != GetVS6TargetName(j->first)))
        {
        // Compute the proper name to use to link this library.
***************
*** 1405,1414 ****
      cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_RELWITHDEBINFO",
                                   targetImplibFlagRelWithDebInfo.c_str());
!     cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
  #ifdef CM_USE_OLD_VS6
!     // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH 
      // are already quoted in the template file,
      // we need to remove the quotes here, we still need
!     // to convert to output path for unix to win32 conversion 
      cmSystemTools::ReplaceString
        (line, "LIBRARY_OUTPUT_PATH",
--- 1410,1422 ----
      cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_RELWITHDEBINFO",
                                   targetImplibFlagRelWithDebInfo.c_str());
! 
!     std::string vs6name = GetVS6TargetName(libName);
!     cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", vs6name.c_str());
! 
  #ifdef CM_USE_OLD_VS6
!     // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH
      // are already quoted in the template file,
      // we need to remove the quotes here, we still need
!     // to convert to output path for unix to win32 conversion
      cmSystemTools::ReplaceString
        (line, "LIBRARY_OUTPUT_PATH",



More information about the Cmake-commits mailing list