summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-12-28 19:59:06 (GMT)
committerBrad King <brad.king@kitware.com>2007-12-28 19:59:06 (GMT)
commit59aa144516c36ff4b25028c9617383f57e780900 (patch)
treeff1028291bfbc1e32a4089b92eebd76c588581eb /Source/cmMakefileTargetGenerator.cxx
parent0a7bb4112954068b25adc116f9cf6c0baeb6cf3e (diff)
downloadCMake-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.cxx32
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);
+}