diff options
author | Brad King <brad.king@kitware.com> | 2009-09-29 20:39:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-09-29 20:39:07 (GMT) |
commit | 024d05adada5b9deaac84f0f4df8beed273c972a (patch) | |
tree | 7e217bb3e29c8dd9f230dd5dc7f290e9e8b1dec6 /Source/cmLocalVisualStudio7Generator.cxx | |
parent | caee3af3c5625d1a181c90efdff6fb599f21f699 (diff) | |
download | CMake-024d05adada5b9deaac84f0f4df8beed273c972a.zip CMake-024d05adada5b9deaac84f0f4df8beed273c972a.tar.gz CMake-024d05adada5b9deaac84f0f4df8beed273c972a.tar.bz2 |
Fix use of module .def files for MS tools
We recognize .def source files and map them to the /DEF:<file> option in
the MSVC tools. Previously this worked only for shared libraries. This
commit cleans up the implementation and makes it work for executables
too. See issue #9613.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 13ad508..8639adb 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -887,6 +887,12 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, Options linkOptions(this, this->Version, Options::Linker, cmLocalVisualStudio7GeneratorLinkFlagTable); linkOptions.Parse(extraLinkOptions.c_str()); + if(!this->ModuleDefinitionFile.empty()) + { + std::string defFile = + this->ConvertToXMLOutputPath(this->ModuleDefinitionFile.c_str()); + linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); + } switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: @@ -960,7 +966,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - this->OutputModuleDefinitionFile(fout, target); temp = target.GetDirectory(configName); temp += "/"; temp += targetNamePDB; @@ -1080,26 +1085,6 @@ cmLocalVisualStudio7Generator fout << "\t\t\t\tVersion=\"" << major << "." << minor << "\"\n"; } -void cmLocalVisualStudio7Generator -::OutputModuleDefinitionFile(std::ostream& fout, - cmTarget &target) -{ - std::vector<cmSourceFile*> const& classes = target.GetSourceFiles(); - for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - cmSourceFile* sf = *i; - if(cmSystemTools::UpperCase(sf->GetExtension()) == "DEF") - { - fout << "\t\t\t\tModuleDefinitionFile=\"" - << this->ConvertToXMLOutputPath(sf->GetFullPath().c_str()) - << "\"\n"; - return; - } - } - -} - //---------------------------------------------------------------------------- void cmLocalVisualStudio7GeneratorInternals @@ -1174,6 +1159,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); // get the classes from the source lists then add them to the groups + this->ModuleDefinitionFile = ""; std::vector<cmSourceFile*>const & classes = target.GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = classes.begin(); i != classes.end(); i++) |