summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.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/cmNinjaNormalTargetGenerator.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/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx61
1 files changed, 21 insertions, 40 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 9bf0ccd..300618f 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -860,19 +860,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
- if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
- (gt.GetType() == cmStateEnums::SHARED_LIBRARY ||
- gt.IsExecutableWithExports())) {
- if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
- std::string name_of_def_file = gt.GetSupportDirectory();
- name_of_def_file += "/" + gt.GetName();
- name_of_def_file += ".def ";
- vars["LINK_FLAGS"] += " /DEF:";
- vars["LINK_FLAGS"] += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file, cmOutputConverter::SHELL);
- }
- }
-
// Add OS X version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
@@ -989,33 +976,27 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
// maybe create .def file from list of objects
- if ((gt.GetType() == cmStateEnums::SHARED_LIBRARY ||
- gt.IsExecutableWithExports()) &&
- this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
- if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) {
- std::string cmakeCommand =
- this->GetLocalGenerator()->ConvertToOutputFormat(
- cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
- std::string name_of_def_file = gt.GetSupportDirectory();
- name_of_def_file += "/" + gt.GetName();
- name_of_def_file += ".def";
- std::string cmd = cmakeCommand;
- cmd += " -E __create_def ";
- cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file, cmOutputConverter::SHELL);
- cmd += " ";
- cmNinjaDeps objs = this->GetObjects();
- std::string obj_list_file = name_of_def_file;
- obj_list_file += ".objs";
- cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- obj_list_file, cmOutputConverter::SHELL);
- preLinkCmdLines.push_back(cmd);
- // create a list of obj files for the -E __create_def to read
- cmGeneratedFileStream fout(obj_list_file.c_str());
- for (cmNinjaDeps::iterator i = objs.begin(); i != objs.end(); ++i) {
- if (cmHasLiteralSuffix(*i, ".obj")) {
- fout << *i << "\n";
- }
+ cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
+ gt.GetModuleDefinitionInfo(this->GetConfigName());
+ if (mdi && mdi->WindowsExportAllSymbols) {
+ std::string cmakeCommand =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
+ std::string cmd = cmakeCommand;
+ cmd += " -E __create_def ";
+ cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
+ mdi->DefFile, cmOutputConverter::SHELL);
+ cmd += " ";
+ cmNinjaDeps objs = this->GetObjects();
+ std::string obj_list_file = mdi->DefFile + ".objs";
+ cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
+ obj_list_file, cmOutputConverter::SHELL);
+ preLinkCmdLines.push_back(cmd);
+ // create a list of obj files for the -E __create_def to read
+ cmGeneratedFileStream fout(obj_list_file.c_str());
+ for (cmNinjaDeps::iterator i = objs.begin(); i != objs.end(); ++i) {
+ if (cmHasLiteralSuffix(*i, ".obj")) {
+ fout << *i << "\n";
}
}
}