From fc933df1fc303f305735d28e9e8a0fb43b41ca1a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 11 Mar 2002 12:11:20 -0500 Subject: [PATCH] ENH: add support for .def files --- Source/cmMSDotNETGenerator.cxx | 28 ++++++++++++++++++++++++++-- Source/cmMSDotNETGenerator.h | 3 +++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx index 998c3a6a9..f47b822f2 100644 --- a/Source/cmMSDotNETGenerator.cxx +++ b/Source/cmMSDotNETGenerator.cxx @@ -837,6 +837,7 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, configName, libName, target); fout << "\"\n"; + this->OutputModuleDefinitionFile(fout, target); fout << "\t\t\t\tProgramDatabaseFile=\"" << m_LibraryOutputPath << "$(OutDir)\\" << libName << ".pdb\"\n"; if(strcmp(configName, "Debug") == 0) @@ -887,6 +888,24 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout, } } +void cmMSDotNETGenerator::OutputModuleDefinitionFile(std::ostream& fout, + const cmTarget &target) +{ + std::vector const& classes = target.GetSourceFiles(); + for(std::vector::const_iterator i = classes.begin(); + i != classes.end(); i++) + { + if(cmSystemTools::UpperCase(i->GetSourceExtension()) == "DEF") + { + fout << "\t\t\t\tModuleDefinitionFile=\"" + << this->ConvertToXMLOutputPath(i->GetFullPath().c_str()) + << "\"\n"; + return; + } + } + +} + void cmMSDotNETGenerator::OutputLibraryDirectories(std::ostream& fout, const char* configName, const char* libName, @@ -992,12 +1011,17 @@ void cmMSDotNETGenerator::WriteVCProjFile(std::ostream& fout, std::vector sourceGroups = m_Makefile->GetSourceGroups(); // get the classes from the source lists then add them to the groups - std::vector classes = target.GetSourceFiles(); - for(std::vector::iterator i = classes.begin(); + std::vector const& classes = target.GetSourceFiles(); + for(std::vector::const_iterator i = classes.begin(); i != classes.end(); i++) { // Add the file to the list of sources. std::string source = i->GetFullPath(); + if(cmSystemTools::UpperCase(i->GetSourceExtension()) == "DEF") + { + m_ModuleDefinitionFile = i->GetFullPath(); + } + cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(), sourceGroups); sourceGroup.AddSource(source.c_str(), &(*i)); diff --git a/Source/cmMSDotNETGenerator.h b/Source/cmMSDotNETGenerator.h index 8b8a65261..5144a348a 100644 --- a/Source/cmMSDotNETGenerator.h +++ b/Source/cmMSDotNETGenerator.h @@ -143,6 +143,8 @@ private: const char* configName, const char* libName, const cmTarget &target); + void OutputModuleDefinitionFile(std::ostream& fout, + const cmTarget &target); void OutputLibraries(std::ostream& fout, const char* configName, const char* libName, @@ -153,6 +155,7 @@ private: bool m_BuildSLN; std::string m_LibraryOutputPath; std::string m_ExecutableOutputPath; + std::string m_ModuleDefinitionFile; std::vector m_Configurations; std::string m_VCProjHeaderTemplate; std::string m_VCProjFooterTemplate;