[Cmake-commits] [cmake-commits] king committed cmLocalVisualStudio7Generator.cxx 1.240 1.241 cmLocalVisualStudio7Generator.h 1.53 1.54 cmLocalVisualStudioGenerator.cxx 1.16 1.17 cmLocalVisualStudioGenerator.h 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jun 16 11:44:10 EDT 2009


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

Modified Files:
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h 
	cmLocalVisualStudioGenerator.cxx 
	cmLocalVisualStudioGenerator.h 
Log Message:
ENH: Generalize exe implib dir creation for VS

In VS 7,8,9 executable targets we generate a build event to create the
output directory for the import library in case the executable marks
symbols with dllexport (VS forgets to create this directory).  This
generalizes computation of the custom command line to support future use
with other VS versions.


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.240
retrieving revision 1.241
diff -C 2 -d -r1.240 -r1.241
*** cmLocalVisualStudio7Generator.cxx	15 Jun 2009 14:55:17 -0000	1.240
--- cmLocalVisualStudio7Generator.cxx	16 Jun 2009 15:44:06 -0000	1.241
***************
*** 1675,1705 ****
  }
  
- void cmLocalVisualStudio7Generator::MaybeCreateImplibDir(cmTarget& target,
-                                                          const char* config,
-                                                          EventWriter& event)
- {
-   // If an executable exports symbols then VS wants to create an
-   // import library but forgets to create the output directory.
-   if(target.GetType() != cmTarget::EXECUTABLE) { return; }
-   std::string outDir = target.GetDirectory(config, false);
-   std::string impDir = target.GetDirectory(config, true);
-   if(impDir == outDir) { return; }
- 
-   // Add a pre-build 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(impDir);
-   std::vector<std::string> no_output;
-   std::vector<std::string> no_depends;
-   cmCustomCommandLines commands;
-   commands.push_back(command);
-   cmCustomCommand cc(no_output, no_depends, commands, 0, 0);
-   cc.SetEscapeOldStyle(false);
-   cc.SetEscapeAllowMakeVars(true);
-   event.Write(cc);
- }
- 
  
  // look for custom rules on a target and collect them together
--- 1675,1678 ----
***************
*** 1721,1725 ****
    event.Start(tool);
    event.Write(target.GetPreBuildCommands());
!   this->MaybeCreateImplibDir(target, configName, event);
    event.Finish();
  
--- 1694,1703 ----
    event.Start(tool);
    event.Write(target.GetPreBuildCommands());
!   cmsys::auto_ptr<cmCustomCommand> pcc(
!     this->MaybeCreateImplibDir(target, configName));
!   if(pcc.get())
!     {
!     event.Write(*pcc);
!     }
    event.Finish();
  

Index: cmLocalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmLocalVisualStudioGenerator.cxx	15 Jan 2008 19:00:52 -0000	1.16
--- cmLocalVisualStudioGenerator.cxx	16 Jun 2009 15:44:07 -0000	1.17
***************
*** 35,38 ****
--- 35,68 ----
  
  //----------------------------------------------------------------------------
+ cmsys::auto_ptr<cmCustomCommand>
+ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
+                                                    const char* config)
+ {
+   cmsys::auto_ptr<cmCustomCommand> pcc;
+ 
+   // If an executable exports symbols then VS wants to create an
+   // import library but forgets to create the output directory.
+   if(target.GetType() != cmTarget::EXECUTABLE) { return pcc; }
+   std::string outDir = target.GetDirectory(config, false);
+   std::string impDir = target.GetDirectory(config, true);
+   if(impDir == outDir) { return pcc; }
+ 
+   // Add a pre-build 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(impDir);
+   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;
+ }
+ 
+ //----------------------------------------------------------------------------
  bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf)
  {

Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -C 2 -d -r1.53 -r1.54
*** cmLocalVisualStudio7Generator.h	15 Jun 2009 14:55:20 -0000	1.53
--- cmLocalVisualStudio7Generator.h	16 Jun 2009 15:44:07 -0000	1.54
***************
*** 126,131 ****
    class EventWriter;
    friend class EventWriter;
-   void MaybeCreateImplibDir(cmTarget& target, const char* config,
-                             EventWriter& event);
  
    cmVS7FlagTable const* ExtraFlagTable;
--- 126,129 ----

Index: cmLocalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** cmLocalVisualStudioGenerator.h	27 Aug 2007 21:05:43 -0000	1.8
--- cmLocalVisualStudioGenerator.h	16 Jun 2009 15:44:07 -0000	1.9
***************
*** 20,23 ****
--- 20,25 ----
  #include "cmLocalGenerator.h"
  
+ #include <cmsys/auto_ptr.hxx>
+ 
  class cmSourceFile;
  class cmSourceGroup;
***************
*** 36,39 ****
--- 38,45 ----
  protected:
  
+   /** Construct a custom command to make exe import lib dir.  */
+   cmsys::auto_ptr<cmCustomCommand>
+   MaybeCreateImplibDir(cmTarget& target, const char* config);
+ 
    /** Construct a script from the given list of command lines.  */
    std::string ConstructScript(const cmCustomCommandLines& commandLines,



More information about the Cmake-commits mailing list