summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2015-06-19 20:12:43 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-06 15:11:02 (GMT)
commit8f86407cfd4331dc1f2eb67f4f179ed8fe9dea06 (patch)
tree8d6670fe80a98055f6302241bb7177ea7d22b77d /Source/cmLocalVisualStudio7Generator.cxx
parent069aa93b555293679f4b8c07623133ba62a74ee4 (diff)
downloadCMake-8f86407cfd4331dc1f2eb67f4f179ed8fe9dea06.zip
CMake-8f86407cfd4331dc1f2eb67f4f179ed8fe9dea06.tar.gz
CMake-8f86407cfd4331dc1f2eb67f4f179ed8fe9dea06.tar.bz2
Windows: Optionally generate DLL module definition files automatically
Create target property WINDOWS_EXPORT_ALL_SYMBOLS to automatically generate a module definition file from MS-compatible .obj files and give it to the linker in order to export all symbols from the .dll part of a SHARED library.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index dc3a16d..a0e9e4d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1081,6 +1081,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL);
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
+ if (target.GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def");
+ }
+ }
switch(target.GetType())
{
case cmTarget::UNKNOWN_LIBRARY:
@@ -2015,7 +2023,28 @@ void cmLocalVisualStudio7Generator
// Add pre-link event.
tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool";
event.Start(tool);
- event.Write(target.GetPreLinkCommands());
+ bool addedPrelink = false;
+ if (target.GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ addedPrelink = true;
+ std::vector<cmCustomCommand> commands =
+ target.GetPreLinkCommands();
+ cmGlobalVisualStudioGenerator* gg
+ = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+ gg->AddSymbolExportCommand(
+ gt, commands, configName);
+ event.Write(commands);
+ }
+ }
+ if (!addedPrelink)
+ {
+ event.Write(target.GetPreLinkCommands());
+ }
cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject));
if(pcc.get())