diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 25f33d7e3..cce10ce77 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -526,106 +526,6 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, - cmGeneratorTarget& target) -{ - std::string objs; - std::vector objVector; - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - // Add all the sources outputs to the depends of the target - std::vector classes; - target.GetSourceFiles(classes, config); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); ++i) - { - cmSourceFile* sf = *i; - if(!sf->GetCustomCommand() && - !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) - { - std::string dir_max; - dir_max += this->StateSnapshot.GetDirectory().GetCurrentBinary(); - dir_max += "/"; - std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); - if(!obj.empty()) - { - std::string ofname = - this->StateSnapshot.GetDirectory().GetCurrentBinary(); - ofname += "/"; - ofname += obj; - objVector.push_back(ofname); - this->AddCustomCommandToCreateObject(ofname.c_str(), - llang, *(*i), target); - objs += this->Convert(ofname,START_OUTPUT,SHELL); - objs += " "; - } - } - } - std::string createRule = target.GetCreateRuleVariable(llang, config); - bool useWatcomQuote = this->Makefile->IsOn(createRule+"_USE_WATCOM_QUOTE"); - std::string targetName = target.Target->GetFullName(); - // Executable : - // Shared Library: - // Static Library: - // Shared Module: - std::string linkLibs; // should be set - std::string frameworkPath; - std::string linkPath; - std::string flags; // should be set - std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - &target, useWatcomQuote); - linkLibs = frameworkPath + linkPath + linkLibs; - cmLocalGenerator::RuleVariables vars; - vars.Language = llang.c_str(); - vars.Objects = objs.c_str(); - vars.ObjectDir = "."; - vars.Target = targetName.c_str(); - vars.LinkLibraries = linkLibs.c_str(); - vars.Flags = flags.c_str(); - vars.LinkFlags = linkFlags.c_str(); - - std::string langFlags; - this->AddLanguageFlags(langFlags, llang, ""); - this->AddArchitectureFlags(langFlags, &target, llang, ""); - vars.LanguageCompileFlags = langFlags.c_str(); - - cmCustomCommandLines commandLines; - std::vector rules; - rules.push_back(this->Makefile->GetRequiredDefinition(createRule)); - std::vector commands; - cmSystemTools::ExpandList(rules, commands); - for(std::vector::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 cmd = cmSystemTools::ParseArguments(i->c_str()); - commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); - - // Store this command line. - commandLines.push_back(commandLine); - } - std::string targetFullPath = target.Target->GetFullPath(); - // Generate a meaningful comment for the command. - std::string comment = "Linking "; - comment += llang; - comment += " target "; - comment += this->Convert(targetFullPath, START_OUTPUT); - this->Makefile->AddCustomCommandToOutput( - targetFullPath, - objVector, - "", - commandLines, - comment.c_str(), - this->StateSnapshot.GetDirectory().GetCurrentBinary() - ); - this->Makefile->GetSource(targetFullPath); - target.Target->AddSource(targetFullPath); -} - // List of variables that are replaced when // rules are expanced. These variables are // replaced in the form with GetSafeDefinition(var). diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index fee242042..429d5fcf3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -328,11 +328,6 @@ protected: void InsertRuleLauncher(std::string& s, cmTarget* target, const std::string& prop); - - /** Convert a target to a utility target for unsupported - * languages of a generator */ - void AddBuildTargetRule(const std::string& llang, - cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, const std::string& lang,