[Cmake-commits] [cmake-commits] king committed cmLocalVisualStudio7Generator.cxx 1.239 1.240 cmLocalVisualStudio7Generator.h 1.52 1.53

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jun 15 10:55:23 EDT 2009


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

Modified Files:
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h 
Log Message:
BUG: Create an exe's implib output dir for VS

If an executable marks symbols with __declspec(dllexport) then VS
creates an import library for it.  However, it forgets to create the
directory that will contain the import library if it is different from
the location of the executable.  We work around this VS bug by creating
a pre-build event on the executable target to make the directory.


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.239
retrieving revision 1.240
diff -C 2 -d -r1.239 -r1.240
*** cmLocalVisualStudio7Generator.cxx	12 Jun 2009 19:28:48 -0000	1.239
--- cmLocalVisualStudio7Generator.cxx	15 Jun 2009 14:55:17 -0000	1.240
***************
*** 1675,1678 ****
--- 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
***************
*** 1694,1697 ****
--- 1721,1725 ----
    event.Start(tool);
    event.Write(target.GetPreBuildCommands());
+   this->MaybeCreateImplibDir(target, configName, event);
    event.Finish();
  

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



More information about the Cmake-commits mailing list