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/cmMakefileTargetGenerator.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/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5a8c0aa..94e0833 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -170,6 +170,10 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // This is an external object file. Just add it. this->ExternalObjects.push_back((*source)->GetFullPath()); } + else if(cmSystemTools::UpperCase((*source)->GetExtension()) == "DEF") + { + this->ModuleDefinitionFile = (*source)->GetFullPath(); + } else { // We only get here if a source file is not an external object @@ -1734,3 +1738,27 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) } } } + +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) +{ + if(this->ModuleDefinitionFile.empty()) + { + return; + } + + // TODO: Create a per-language flag variable. + const char* defFileFlag = + this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG"); + if(!defFileFlag) + { + return; + } + + // Append the flag and value. + std::string flag = defFileFlag; + flag += this->Convert(this->ModuleDefinitionFile.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + this->LocalGenerator->AppendFlags(flags, flag.c_str()); +} |