diff options
author | Brad King <brad.king@kitware.com> | 2007-12-28 19:59:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-12-28 19:59:06 (GMT) |
commit | 59aa144516c36ff4b25028c9617383f57e780900 (patch) | |
tree | ff1028291bfbc1e32a4089b92eebd76c588581eb /Source/cmMakefileTargetGenerator.cxx | |
parent | 0a7bb4112954068b25adc116f9cf6c0baeb6cf3e (diff) | |
download | CMake-59aa144516c36ff4b25028c9617383f57e780900.zip CMake-59aa144516c36ff4b25028c9617383f57e780900.tar.gz CMake-59aa144516c36ff4b25028c9617383f57e780900.tar.bz2 |
ENH: Simplified and moved link script implementation up from cmMakefileLibraryTargetGenerator to cmMakefileTargetGenerator and use for cmMakefileExecutableTargetGenerator too. This addresses bug #6192.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e780219..13c1b64 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1391,3 +1391,35 @@ cmMakefileTargetGenerator MultipleOutputPairsType::value_type p(depender, dependee); this->MultipleOutputPairs.insert(p); } + +//---------------------------------------------------------------------------- +void +cmMakefileTargetGenerator +::CreateLinkScript(const char* name, + std::vector<std::string> const& link_commands, + std::vector<std::string>& makefile_commands) +{ + // Create the link script file. + std::string linkScriptName = this->TargetBuildDirectoryFull; + linkScriptName += "/"; + linkScriptName += name; + cmGeneratedFileStream linkScriptStream(linkScriptName.c_str()); + for(std::vector<std::string>::const_iterator cmd = link_commands.begin(); + cmd != link_commands.end(); ++cmd) + { + // Do not write out empty commands or commands beginning in the + // shell no-op ":". + if(!cmd->empty() && (*cmd)[0] != ':') + { + linkScriptStream << *cmd << "\n"; + } + } + + // Create the makefile command to invoke the link script. + std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script "; + link_command += this->Convert(linkScriptName.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + link_command += " --verbose=$(VERBOSE)"; + makefile_commands.push_back(link_command); +} |