summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2011-01-13 04:39:13 (GMT)
committerBrad King <brad.king@kitware.com>2011-04-25 17:27:58 (GMT)
commitfe07b0557b0b6cc47c29547d9c1d30a2b440fcd8 (patch)
treec88cc211a9e281ae5d3cfe2b6109c061ebd25c30 /Source/cmMakefileTargetGenerator.cxx
parent65c0c24a296c12c8037361cc5c53d884c4cde5f0 (diff)
downloadCMake-fe07b0557b0b6cc47c29547d9c1d30a2b440fcd8.zip
CMake-fe07b0557b0b6cc47c29547d9c1d30a2b440fcd8.tar.gz
CMake-fe07b0557b0b6cc47c29547d9c1d30a2b440fcd8.tar.bz2
implement cxx command output
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 1c45f18..e5df2f4 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -658,6 +658,9 @@ cmMakefileTargetGenerator
vars.Flags = flags.c_str();
vars.Defines = defines.c_str();
+ bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) ||
+ (strcmp(lang, "CXX") == 0));
+
// Construct the compile rules.
{
std::string compileRuleVar = "CMAKE_";
@@ -668,6 +671,22 @@ cmMakefileTargetGenerator
std::vector<std::string> compileCommands;
cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ if (lang_is_c_or_cxx && compileCommands.size() == 1)
+ {
+ std::string compileCommand = compileCommands[0];
+ this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
+ std::string workingDirectory =
+ this->LocalGenerator->Convert(
+ this->Makefile->GetStartOutputDirectory(), cmLocalGenerator::FULL);
+ compileCommand.replace(compileCommand.find(langFlags),
+ langFlags.size(), this->GetFlags(lang));
+ std::string langDefines = std::string("$(") + lang + "_DEFINES)";
+ compileCommand.replace(compileCommand.find(langDefines),
+ langDefines.size(), this->GetDefines(lang));
+ this->GlobalGenerator->AddCXXCompileCommand(
+ source.GetFullPath(), workingDirectory, compileCommand);
+ }
+
// Expand placeholders in the commands.
for(std::vector<std::string>::iterator i = compileCommands.begin();
i != compileCommands.end(); ++i)
@@ -708,8 +727,6 @@ cmMakefileTargetGenerator
}
}
- bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) ||
- (strcmp(lang, "CXX") == 0));
bool do_preprocess_rules = lang_is_c_or_cxx &&
this->LocalGenerator->GetCreatePreprocessedSourceRules();
bool do_assembly_rules = lang_is_c_or_cxx &&