summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-06-16 11:44:07 -0400
committerBrad King <brad.king@kitware.com>2009-06-16 11:44:07 -0400
commit764ac9803d8f7c33fed29ef43563d894161797fa (patch)
tree15687a8b8ac50e30051825ff4173a3051f7b9ab1 /Source/cmLocalVisualStudioGenerator.cxx
parent0f490cf025193ccc6a10e0d1982f08d6de24d019 (diff)
downloadcmake-764ac9803d8f7c33fed29ef43563d894161797fa.tar.gz
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/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 66be038573..4706a966ba 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -34,6 +34,36 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
}
//----------------------------------------------------------------------------
+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)
{
// Identify the language of the source file.