[Cmake-commits] [cmake-commits] king committed cmLocalVisualStudio6Generator.cxx 1.162 1.163 cmLocalVisualStudio6Generator.h 1.26 1.27

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 28 12:19:18 EDT 2009


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

Modified Files:
	cmLocalVisualStudio6Generator.cxx 
	cmLocalVisualStudio6Generator.h 
Log Message:
Create a static library's output dir for VS 6

VS 6 forgets to create the output directory for a static library if it
differs from the intermediate files directory.  We work around this VS
bug by creating a pre-link event on the library target to make the
directory.


Index: cmLocalVisualStudio6Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C 2 -d -r1.26 -r1.27
*** cmLocalVisualStudio6Generator.h	30 Sep 2009 20:03:09 -0000	1.26
--- cmLocalVisualStudio6Generator.h	28 Oct 2009 16:19:15 -0000	1.27
***************
*** 82,85 ****
--- 82,87 ----
    class EventWriter;
    friend class EventWriter;
+   cmsys::auto_ptr<cmCustomCommand>
+   MaybeCreateOutputDir(cmTarget& target, const char* config);
    std::string CreateTargetRules(cmTarget &target, 
                                  const char* configName, 

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.162
retrieving revision 1.163
diff -C 2 -d -r1.162 -r1.163
*** cmLocalVisualStudio6Generator.cxx	28 Oct 2009 16:18:52 -0000	1.162
--- cmLocalVisualStudio6Generator.cxx	28 Oct 2009 16:19:15 -0000	1.163
***************
*** 826,829 ****
--- 826,857 ----
  }
  
+ //----------------------------------------------------------------------------
+ cmsys::auto_ptr<cmCustomCommand>
+ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
+                                                     const char* config)
+ {
+   cmsys::auto_ptr<cmCustomCommand> pcc;
+ 
+   // VS6 forgets to create the output directory for archives if it
+   // differs from the intermediate directory.
+   if(target.GetType() != cmTarget::STATIC_LIBRARY) { return pcc; }
+   std::string outDir = target.GetDirectory(config, false);
+ 
+   // Add a pre-link event to create the directory.
+   cmCustomCommandLine command;
+   command.push_back(this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"));
+   command.push_back("-E");
+   command.push_back("make_directory");
+   command.push_back(outDir);
+   std::vector<std::string> no_output;
+   std::vector<std::string> no_depends;
+   cmCustomCommandLines commands;
+   commands.push_back(command);
+   pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0));
+   pcc->SetEscapeOldStyle(false);
+   pcc->SetEscapeAllowMakeVars(true);
+   return pcc;
+ }
+ 
  // look for custom rules on a target and collect them together
  std::string 
***************
*** 850,853 ****
--- 878,886 ----
      event.Write(*pcc);
      }
+   pcc = this->MaybeCreateOutputDir(target, configName);
+   if(pcc.get())
+     {
+     event.Write(*pcc);
+     }
    event.Finish();
  



More information about the Cmake-commits mailing list