mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
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.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user