summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudio6Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-28 12:19:15 -0400
committerBrad King <brad.king@kitware.com>2009-10-28 12:19:15 -0400
commitb38c2929b0aec6f7ac994ab1e9cbf13052ab1ad6 (patch)
treece5d9ae3c3a39853b38ce29e7eb41a4a06206b5c /Source/cmLocalVisualStudio6Generator.cxx
parent90b8164e444699d97982b199b423a529f66eb13e (diff)
downloadcmake-b38c2929b0aec6f7ac994ab1e9cbf13052ab1ad6.tar.gz
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.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 54f7bf40dd..2cf840df21 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -825,6 +825,34 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
}
}
+//----------------------------------------------------------------------------
+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
cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
@@ -849,6 +877,11 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
{
event.Write(*pcc);
}
+ pcc = this->MaybeCreateOutputDir(target, configName);
+ if(pcc.get())
+ {
+ event.Write(*pcc);
+ }
event.Finish();
// Write the post-build rules.