|
|
@@ -448,84 +448,6 @@ cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
|
|
|
return this->StateSnapshot;
|
|
|
}
|
|
|
|
|
|
-void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
|
|
- const std::string& lang,
|
|
|
- cmSourceFile& source,
|
|
|
- cmGeneratorTarget& target)
|
|
|
-{
|
|
|
- std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
|
|
|
- objectDir = this->Convert(objectDir,START_OUTPUT,SHELL);
|
|
|
- std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
|
|
|
- std::string sourceFile =
|
|
|
- this->ConvertToOutputFormat(source.GetFullPath(), SHELL);
|
|
|
- std::string varString = "CMAKE_";
|
|
|
- varString += lang;
|
|
|
- varString += "_COMPILE_OBJECT";
|
|
|
- std::vector<std::string> rules;
|
|
|
- rules.push_back(this->Makefile->GetRequiredDefinition(varString));
|
|
|
- varString = "CMAKE_";
|
|
|
- varString += lang;
|
|
|
- varString += "_FLAGS";
|
|
|
- std::string flags;
|
|
|
- flags += this->Makefile->GetSafeDefinition(varString);
|
|
|
- flags += " ";
|
|
|
- {
|
|
|
- std::vector<std::string> includes;
|
|
|
- this->GetIncludeDirectories(includes, &target, lang);
|
|
|
- flags += this->GetIncludeFlags(includes, &target, lang);
|
|
|
- }
|
|
|
- flags += this->Makefile->GetDefineFlags();
|
|
|
-
|
|
|
- // Construct the command lines.
|
|
|
- cmCustomCommandLines commandLines;
|
|
|
- std::vector<std::string> commands;
|
|
|
- cmSystemTools::ExpandList(rules, commands);
|
|
|
- cmLocalGenerator::RuleVariables vars;
|
|
|
- vars.Language = lang.c_str();
|
|
|
- vars.Source = sourceFile.c_str();
|
|
|
- vars.Object = objectFile.c_str();
|
|
|
- vars.ObjectDir = objectDir.c_str();
|
|
|
- vars.Flags = flags.c_str();
|
|
|
- for(std::vector<std::string>::iterator i = commands.begin();
|
|
|
- i != commands.end(); ++i)
|
|
|
- {
|
|
|
- // Expand the full command line string.
|
|
|
- this->ExpandRuleVariables(*i, vars);
|
|
|
-
|
|
|
- // Parse the string to get the custom command line.
|
|
|
- cmCustomCommandLine commandLine;
|
|
|
- std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
|
|
|
- commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
|
|
|
-
|
|
|
- // Store this command line.
|
|
|
- commandLines.push_back(commandLine);
|
|
|
- }
|
|
|
-
|
|
|
- // Check for extra object-file dependencies.
|
|
|
- std::vector<std::string> depends;
|
|
|
- const char* additionalDeps = source.GetProperty("OBJECT_DEPENDS");
|
|
|
- if(additionalDeps)
|
|
|
- {
|
|
|
- cmSystemTools::ExpandListArgument(additionalDeps, depends);
|
|
|
- }
|
|
|
-
|
|
|
- // Generate a meaningful comment for the command.
|
|
|
- std::string comment = "Building ";
|
|
|
- comment += lang;
|
|
|
- comment += " object ";
|
|
|
- comment += this->Convert(ofname, START_OUTPUT);
|
|
|
-
|
|
|
- // Add the custom command to build the object file.
|
|
|
- this->Makefile->AddCustomCommandToOutput(
|
|
|
- ofname,
|
|
|
- depends,
|
|
|
- source.GetFullPath(),
|
|
|
- commandLines,
|
|
|
- comment.c_str(),
|
|
|
- this->StateSnapshot.GetDirectory().GetCurrentBinary()
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
// List of variables that are replaced when
|
|
|
// rules are expanced. These variables are
|
|
|
// replaced in the form <var> with GetSafeDefinition(var).
|