diff options
author | Yury Zhuravlev <stalkerg@gmail.com> | 2016-07-10 17:24:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-07-11 13:40:42 (GMT) |
commit | 2005b960672d2d552585805ea398b02400a576b7 (patch) | |
tree | bfb37361ce6d83483585cbdc9fd74d64dbb9fc16 /Source | |
parent | f2c1900a71a0717b96a0b263186767658de72baa (diff) | |
download | CMake-2005b960672d2d552585805ea398b02400a576b7.zip CMake-2005b960672d2d552585805ea398b02400a576b7.tar.gz CMake-2005b960672d2d552585805ea398b02400a576b7.tar.bz2 |
Makefile: Factor out WINDOWS_EXPORT_ALL_SYMBOLS helper
Factor the implementation out of cmMakefileLibraryTargetGenerator
into a helper method in cmMakefileTargetGenerator so it can be
re-used elsewhere later.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 43 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 43 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 4 |
3 files changed, 48 insertions, 42 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 380fd7d..7de2db0 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -521,48 +521,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // maybe create .def file from list of objects if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - 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->Convert(cmd, cmOutputConverter::NONE, - cmOutputConverter::SHELL); - cmd += " -E __create_def "; - cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); - cmd += " "; - std::string objlist_file = name_of_def_file; - objlist_file += ".objs"; - cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); - real_link_commands.push_back(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) { - fout << *i << "\n"; - } - // now add the def file link flag - linkFlags += " "; - linkFlags += - this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += - this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, - cmOutputConverter::SHELL); - linkFlags += " "; - } + this->GenDefFile(real_link_commands, linkFlags); } std::string manifests = this->GetManifests(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2f9c4da..00b1219 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1595,3 +1595,46 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, this->LocalGenerator->AppendFlags(flags, includeFlags); } } + +void cmMakefileTargetGenerator::GenDefFile( + std::vector<std::string>& real_link_commands, std::string& linkFlags) +{ + 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->Convert(cmd, cmOutputConverter::NONE, cmOutputConverter::SHELL); + cmd += " -E __create_def "; + cmd += this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); + cmd += " "; + std::string objlist_file = name_of_def_file; + objlist_file += ".objs"; + cmd += this->Convert(objlist_file, cmOutputConverter::START_OUTPUT, + 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) { + fout << *i << "\n"; + } + // now add the def file link flag + linkFlags += " "; + linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + linkFlags += + this->Convert(name_of_def_file, cmOutputConverter::START_OUTPUT, + cmOutputConverter::SHELL); + linkFlags += " "; + } +} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 7749d8b..4284549 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -162,6 +162,10 @@ protected: std::vector<std::string>& makefile_depends, bool useWatcomQuote); + /** Add commands for generate def files */ + void GenDefFile(std::vector<std::string>& real_link_commands, + std::string& linkFlags); + void AddIncludeFlags(std::string& flags, const std::string& lang) CM_OVERRIDE; |