summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-09 20:56:30 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-09 21:25:15 (GMT)
commitf36eaf6a6eb8a7ef1127ad43e419896be89f0e39 (patch)
treed51a6a1ab0d1c894137b71f2c2b732cb7f238a32 /Source/cmMakefileTargetGenerator.cxx
parent25d261efa7c80ce7d9cbcb8b94d5d4a77cb12aaf (diff)
downloadCMake-f36eaf6a6eb8a7ef1127ad43e419896be89f0e39.zip
CMake-f36eaf6a6eb8a7ef1127ad43e419896be89f0e39.tar.gz
CMake-f36eaf6a6eb8a7ef1127ad43e419896be89f0e39.tar.bz2
Refactor WINDOWS_EXPORT_ALL_SYMBOLS implementation
Use `cmGeneratorTarget::ModuleDefinitionInfo` to combine the implementation of `WINDOWS_EXPORT_ALL_SYMBOLS` with that of using a `.def` file as a source. Only one of these could be used within a single target before anyway.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx74
1 files changed, 32 insertions, 42 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d9361f3..1fa8702 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1416,7 +1416,7 @@ void cmMakefileTargetGenerator::AppendLinkDepends(
// Add a dependency on the link definitions file, if any.
cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName());
- if (mdi && !mdi->DefFile.empty()) {
+ if (mdi && !mdi->WindowsExportAllSymbols && !mdi->DefFile.empty()) {
depends.push_back(mdi->DefFile);
}
@@ -1720,49 +1720,39 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
}
void cmMakefileTargetGenerator::GenDefFile(
- std::vector<std::string>& real_link_commands, std::string& linkFlags)
+ std::vector<std::string>& real_link_commands)
{
- if (this->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
- std::string name_of_def_file =
- this->GeneratorTarget->GetSupportDirectory();
- name_of_def_file += std::string("/") + this->GeneratorTarget->GetName();
- name_of_def_file += ".def";
- std::string cmd = cmSystemTools::GetCMakeCommand();
- cmd = this->LocalGenerator->ConvertToOutputFormat(
- cmd, cmOutputConverter::SHELL);
- cmd += " -E __create_def ";
- cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->MaybeConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
- cmOutputConverter::SHELL);
- cmd += " ";
- std::string objlist_file = name_of_def_file;
- objlist_file += ".objs";
- cmd += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->MaybeConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
- cmOutputConverter::SHELL);
- real_link_commands.insert(real_link_commands.begin(), cmd);
- // create a list of obj files for the -E __create_def to read
- cmGeneratedFileStream fout(objlist_file.c_str());
- for (std::vector<std::string>::const_iterator i = this->Objects.begin();
- i != this->Objects.end(); ++i) {
- if (cmHasLiteralSuffix(*i, ".obj")) {
- fout << *i << "\n";
- }
- }
- for (std::vector<std::string>::const_iterator i =
- this->ExternalObjects.begin();
- i != this->ExternalObjects.end(); ++i) {
+ cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
+ this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName());
+ if (!mdi || !mdi->WindowsExportAllSymbols) {
+ return;
+ }
+ std::string cmd = cmSystemTools::GetCMakeCommand();
+ cmd =
+ this->LocalGenerator->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL);
+ cmd += " -E __create_def ";
+ cmd += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), mdi->DefFile),
+ cmOutputConverter::SHELL);
+ cmd += " ";
+ std::string objlist_file = mdi->DefFile + ".objs";
+ cmd += this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
+ cmOutputConverter::SHELL);
+ real_link_commands.insert(real_link_commands.begin(), cmd);
+ // create a list of obj files for the -E __create_def to read
+ cmGeneratedFileStream fout(objlist_file.c_str());
+ for (std::vector<std::string>::const_iterator i = this->Objects.begin();
+ i != this->Objects.end(); ++i) {
+ if (cmHasLiteralSuffix(*i, ".obj")) {
fout << *i << "\n";
}
- // now add the def file link flag
- linkFlags += " ";
- linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- linkFlags += this->LocalGenerator->ConvertToOutputFormat(
- this->LocalGenerator->MaybeConvertToRelativePath(
- this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
- cmOutputConverter::SHELL);
- linkFlags += " ";
+ }
+ for (std::vector<std::string>::const_iterator i =
+ this->ExternalObjects.begin();
+ i != this->ExternalObjects.end(); ++i) {
+ fout << *i << "\n";
}
}