summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-06-16 15:44:07 (GMT)
committerBrad King <brad.king@kitware.com>2009-06-16 15:44:07 (GMT)
commit764ac9803d8f7c33fed29ef43563d894161797fa (patch)
tree15687a8b8ac50e30051825ff4173a3051f7b9ab1 /Source/cmLocalVisualStudio7Generator.cxx
parent0f490cf025193ccc6a10e0d1982f08d6de24d019 (diff)
downloadCMake-764ac9803d8f7c33fed29ef43563d894161797fa.zip
CMake-764ac9803d8f7c33fed29ef43563d894161797fa.tar.gz
CMake-764ac9803d8f7c33fed29ef43563d894161797fa.tar.bz2
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.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx34
1 files changed, 6 insertions, 28 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 31fcb1d..ddeeb83 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1674,33 +1674,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
fout << "\t\t</Filter>\n";
}
-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
void cmLocalVisualStudio7Generator
@@ -1720,7 +1693,12 @@ void cmLocalVisualStudio7Generator
this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool";
event.Start(tool);
event.Write(target.GetPreBuildCommands());
- this->MaybeCreateImplibDir(target, configName, event);
+ cmsys::auto_ptr<cmCustomCommand> pcc(
+ this->MaybeCreateImplibDir(target, configName));
+ if(pcc.get())
+ {
+ event.Write(*pcc);
+ }
event.Finish();
// Add pre-link event.