From 3e8ef6427393546c77da1b74234311d3b60edd98 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 9 Oct 2015 22:19:57 +0200 Subject: cmLocalGenerator: Port some API to cmGeneratorTarget. --- Source/cmCommonTargetGenerator.cxx | 9 ++-- Source/cmExtraSublimeTextGenerator.cxx | 6 +-- Source/cmGhsMultiTargetGenerator.cxx | 13 +++-- Source/cmGlobalXCodeGenerator.cxx | 8 +-- Source/cmLocalGenerator.cxx | 68 +++++++++++++------------- Source/cmLocalGenerator.h | 22 +++++---- Source/cmLocalUnixMakefileGenerator3.cxx | 26 +++++----- Source/cmLocalUnixMakefileGenerator3.h | 9 ++-- Source/cmLocalVisualStudio6Generator.cxx | 20 ++++---- Source/cmLocalVisualStudio7Generator.cxx | 4 +- Source/cmMakefileExecutableTargetGenerator.cxx | 8 +-- Source/cmMakefileLibraryTargetGenerator.cxx | 12 ++--- Source/cmMakefileTargetGenerator.cxx | 7 +-- Source/cmMakefileUtilityTargetGenerator.cxx | 4 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQtAutoGeneratorInitializer.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 4 +- 18 files changed, 119 insertions(+), 107 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a197f88..41af89b 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -316,10 +316,11 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) this->AddFortranFlags(flags); } - this->LocalGenerator->AddCMP0018Flags(flags, this->Target, + this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, this->ConfigName); - this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, + this->LocalGenerator->AddVisibilityPresetFlags(flags, + this->GeneratorTarget, lang); // Append old-style preprocessor definition flags. @@ -331,7 +332,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) AppendFlags(flags,this->GetFrameworkFlags(l)); // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->Target, + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, this->ConfigName); ByLanguageMap::value_type entry(l, flags); @@ -354,7 +355,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l) } // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, + this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(), l); std::string definesString; diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index d1599c4..a6b14ba 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -388,7 +388,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, // } // Add shared-library flags if needed. - lg->AddCMP0018Flags(flags, gtgt->Target, language, config); + lg->AddCMP0018Flags(flags, gtgt, language, config); // Add include directory flags. { @@ -403,7 +403,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, lg->AppendFlags(flags, makefile->GetDefineFlags()); // Add target-specific flags. - lg->AddCompileOptions(flags, gtgt->Target, language, config); + lg->AddCompileOptions(flags, gtgt, language, config); // Add source file specific flags. lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); @@ -433,7 +433,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target->Target, config, language); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index c687ba7..019cdd1 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -265,8 +265,11 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config, this->LocalGenerator->AddLanguageFlags( flags, lang + std::string("_GHS_KERNEL"), config); } - this->LocalGenerator->AddCMP0018Flags(flags, this->Target, lang, config); - this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang); + this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, + lang, config); + this->LocalGenerator->AddVisibilityPresetFlags(flags, + this->GeneratorTarget, + lang); // Append old-style preprocessor definition flags. if (std::string(" ") != std::string(this->Makefile->GetDefineFlags())) @@ -276,7 +279,8 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config, } // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->Target, lang, config); + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, + lang, config); std::map::value_type entry(language, flags); i = this->FlagsByLanguage.insert(entry).first; @@ -299,7 +303,8 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language, } // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions(defines, this->Target, config, + this->LocalGenerator->AddCompileDefinitions(defines, + this->GeneratorTarget, config, language); std::string definesString; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8454bc1..d4ccde6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1814,14 +1814,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); // Add shared-library flags if needed. - this->CurrentLocalGenerator->AddCMP0018Flags(flags, &target, + this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang, configName); - this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, &target, + this->CurrentLocalGenerator->AddVisibilityPresetFlags(flags, gtgt, lang); this->CurrentLocalGenerator-> - AddCompileOptions(flags, &target, lang, configName); + AddCompileOptions(flags, gtgt, lang, configName); } std::string llang = gtgt->GetLinkerLanguage(configName); @@ -1884,7 +1884,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CurrentLocalGenerator ->GetStaticLibraryFlags(extraLinkOptions, cmSystemTools::UpperCase(configName), - &target); + gtgt); } else { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d457e9c..d830e26 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -920,7 +920,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s, } //---------------------------------------------------------------------------- -const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, +const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop) { if(target) @@ -934,7 +934,8 @@ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, } //---------------------------------------------------------------------------- -void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, +void cmLocalGenerator::InsertRuleLauncher(std::string& s, + cmGeneratorTarget* target, const std::string& prop) { if(const char* val = this->GetRuleLauncher(target, prop)) @@ -1087,27 +1088,23 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, - cmTarget const* target, + cmGeneratorTarget const* target, const std::string& config, const std::string& lang) { std::vector targetDefines; - cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(target); - gtgt->GetCompileDefinitions(targetDefines, config, lang); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileOptions( - std::string& flags, cmTarget* target, + std::string& flags, cmGeneratorTarget* target, const std::string& lang, const std::string& config ) { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; - cmGeneratorTarget* gtgt = - this->GlobalGenerator->GetGeneratorTarget(target); - if(const char* langFlagRegexStr = this->Makefile->GetDefinition(langFlagRegexVar)) { @@ -1118,7 +1115,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - gtgt->GetCompileOptions(opts, config, lang); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1139,7 +1136,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - gtgt->GetCompileOptions(opts, config, lang); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1148,19 +1145,19 @@ void cmLocalGenerator::AddCompileOptions( } } std::vector features; - gtgt->GetCompileFeatures(features, config); + target->GetCompileFeatures(features, config); for(std::vector::const_iterator it = features.begin(); it != features.end(); ++it) { - if (!this->Makefile->AddRequiredTargetFeature(target, *it)) + if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) { return; } } for(std::map::const_iterator it - = gtgt->GetMaxLanguageStandards().begin(); - it != gtgt->GetMaxLanguageStandards().end(); ++it) + = target->GetMaxLanguageStandards().begin(); + it != target->GetMaxLanguageStandards().end(); ++it) { const char* standard = target->GetProperty(it->first + "_STANDARD"); if(!standard) @@ -1314,7 +1311,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, std::string const& config, - cmTarget* target) + cmGeneratorTarget* target) { this->AppendFlags(flags, this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS")); @@ -1348,7 +1345,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, switch(target->GetType()) { case cmState::STATIC_LIBRARY: - this->GetStaticLibraryFlags(linkFlags, buildType, target->Target); + this->GetStaticLibraryFlags(linkFlags, buildType, target); break; case cmState::MODULE_LIBRARY: libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS"; @@ -1904,7 +1901,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator:: -AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, +AddCompilerRequirementFlag(std::string &flags, + cmGeneratorTarget const* target, const std::string& lang) { if (lang.empty()) @@ -1942,7 +1940,8 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, "CMAKE_" + lang + standardProp + "_" + type + "_COMPILE_OPTION"; - const char *opt = target->GetMakefile()->GetDefinition(option_flag); + const char *opt = target->Target->GetMakefile() + ->GetDefinition(option_flag); if (!opt) { std::ostringstream e; @@ -1983,7 +1982,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, std::string e = lang + "_STANDARD is set to invalid value '" + standard + "'"; this->GetGlobalGenerator()->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace()); + ->IssueMessage(cmake::FATAL_ERROR, e, target->Target->GetBacktrace()); return; } @@ -2007,7 +2006,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, + "_" + type + "_COMPILE_OPTION"; const char *opt = - target->GetMakefile()->GetRequiredDefinition(option_flag); + target->Target->GetMakefile()->GetRequiredDefinition(option_flag); this->AppendFlagEscape(flags, opt); return; } @@ -2018,7 +2017,8 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, "CMAKE_" + lang + *stdIt + "_" + type + "_COMPILE_OPTION"; - if (const char *opt = target->GetMakefile()->GetDefinition(option_flag)) + if (const char *opt = target->Target + ->GetMakefile()->GetDefinition(option_flag)) { this->AppendFlagEscape(flags, opt); return; @@ -2094,7 +2094,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, //---------------------------------------------------------------------------- void cmLocalGenerator -::AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, +::AddVisibilityPresetFlags(std::string &flags, cmGeneratorTarget const* target, const std::string& lang) { if (lang.empty()) @@ -2106,9 +2106,9 @@ void cmLocalGenerator std::string *pWarnCMP0063 = 0; if (target->GetType() != cmState::SHARED_LIBRARY && target->GetType() != cmState::MODULE_LIBRARY && - !target->IsExecutableWithExports()) + !target->Target->IsExecutableWithExports()) { - switch (target->GetPolicyStatusCMP0063()) + switch (target->Target->GetPolicyStatusCMP0063()) { case cmPolicies::OLD: return; @@ -2120,15 +2120,16 @@ void cmLocalGenerator } } - AddVisibilityCompileOption(flags, target, this, lang, pWarnCMP0063); + AddVisibilityCompileOption(flags, target->Target, this, lang, pWarnCMP0063); if(lang == "CXX") { - AddInlineVisibilityCompileOption(flags, target, this, pWarnCMP0063); + AddInlineVisibilityCompileOption(flags, target->Target, + this, pWarnCMP0063); } if (!warnCMP0063.empty() && - this->WarnCMP0063.insert(target).second) + this->WarnCMP0063.insert(target->Target).second) { std::ostringstream w; w << @@ -2138,14 +2139,15 @@ void cmLocalGenerator "has the following visibility properties set for " << lang << ":\n" << warnCMP0063 << "For compatibility CMake is not honoring them for this target."; - target->GetMakefile()->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, w.str(), target->GetBacktrace()); + target->Target->GetMakefile()->GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + target->Target->GetBacktrace()); } } //---------------------------------------------------------------------------- void cmLocalGenerator::AddCMP0018Flags(std::string &flags, - cmTarget const* target, + cmGeneratorTarget const* target, std::string const& lang, const std::string& config) { @@ -2169,9 +2171,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, return; } - cmGeneratorTarget* gtgt = - this->GlobalGenerator->GetGeneratorTarget(target); - if (gtgt->GetLinkInterfaceDependentBoolProperty( + if (target->GetLinkInterfaceDependentBoolProperty( "POSITION_INDEPENDENT_CODE", config)) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index ee0a618..749a93d 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -20,7 +20,6 @@ class cmMakefile; class cmGlobalGenerator; class cmGeneratorTarget; -class cmTarget; class cmTargetManifest; class cmSourceFile; class cmCustomCommand; @@ -91,13 +90,15 @@ public: void AddLanguageFlags(std::string& flags, const std::string& lang, const std::string& config); - void AddCMP0018Flags(std::string &flags, cmTarget const* target, + void AddCMP0018Flags(std::string &flags, cmGeneratorTarget const* target, std::string const& lang, const std::string& config); - void AddVisibilityPresetFlags(std::string &flags, cmTarget const* target, + void AddVisibilityPresetFlags(std::string &flags, + cmGeneratorTarget const* target, const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, const std::string& config); - void AddCompilerRequirementFlag(std::string &flags, cmTarget const* target, + void AddCompilerRequirementFlag(std::string &flags, + cmGeneratorTarget const* target, const std::string& lang); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const std::string& newFlags); @@ -188,10 +189,10 @@ public: const std::string& lang = "C", const std::string& config = "", bool stripImplicitInclDirs = true) const; - void AddCompileOptions(std::string& flags, cmTarget* target, + void AddCompileOptions(std::string& flags, cmGeneratorTarget* target, const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, - cmTarget const* target, + cmGeneratorTarget const* target, const std::string& config, const std::string& lang); @@ -212,7 +213,7 @@ public: { memset(this, 0, sizeof(*this)); } - cmTarget* CMTarget; + cmGeneratorTarget* CMTarget; const char* TargetPDB; const char* TargetCompilePDB; const char* TargetVersionMajor; @@ -298,7 +299,7 @@ public: /** Fill out the static linker flags for the given target. */ void GetStaticLibraryFlags(std::string& flags, std::string const& config, - cmTarget* target); + cmGeneratorTarget* target); /** Fill out these strings for the given target. Libraries to link, * flags, and linkflags. */ @@ -341,8 +342,9 @@ protected: std::string ExpandRuleVariable(std::string const& variable, const RuleVariables& replaceValues); - const char* GetRuleLauncher(cmTarget* target, const std::string& prop); - void InsertRuleLauncher(std::string& s, cmTarget* target, + const char* GetRuleLauncher(cmGeneratorTarget* target, + const std::string& prop); + void InsertRuleLauncher(std::string& s, cmGeneratorTarget* target, const std::string& prop); // Handle old-style install rules stored in the targets. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f3ee2e3..add0aa9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1034,7 +1034,7 @@ void cmLocalUnixMakefileGenerator3 ::AppendCustomCommands(std::vector& commands, const std::vector& ccs, - cmTarget* target, + cmGeneratorTarget* target, cmLocalGenerator::RelativeRoot relative) { for(std::vector::const_iterator i = ccs.begin(); @@ -1050,7 +1050,7 @@ void cmLocalUnixMakefileGenerator3 ::AppendCustomCommand(std::vector& commands, cmCustomCommandGenerator const& ccg, - cmTarget* target, + cmGeneratorTarget* target, bool echo_comment, cmLocalGenerator::RelativeRoot relative, std::ostream* content) @@ -1181,7 +1181,7 @@ cmLocalUnixMakefileGenerator3 std::string cmLocalUnixMakefileGenerator3::MakeLauncher( cmCustomCommandGenerator const& ccg, - cmTarget* target, RelativeRoot relative) + cmGeneratorTarget* target, RelativeRoot relative) { // Short-circuit if there is no launcher. const char* prop = "RULE_LAUNCH_CUSTOM"; @@ -1788,6 +1788,9 @@ void cmLocalUnixMakefileGenerator3 this->AppendEcho(commands, text, cmLocalUnixMakefileGenerator3::EchoGlobal); + cmGeneratorTarget* gt = this->GlobalGenerator + ->GetGeneratorTarget(&glIt->second); + // Global targets store their rules in pre- and post-build commands. this->AppendCustomDepends(depends, glIt->second.GetPreBuildCommands()); @@ -1795,11 +1798,11 @@ void cmLocalUnixMakefileGenerator3 glIt->second.GetPostBuildCommands()); this->AppendCustomCommands(commands, glIt->second.GetPreBuildCommands(), - &glIt->second, + gt, cmLocalGenerator::START_OUTPUT); this->AppendCustomCommands(commands, glIt->second.GetPostBuildCommands(), - &glIt->second, + gt, cmLocalGenerator::START_OUTPUT); std::string targetName = glIt->second.GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), @@ -1976,10 +1979,11 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, void cmLocalUnixMakefileGenerator3 -::WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &target) +::WriteDependLanguageInfo(std::ostream& cmakefileStream, + cmGeneratorTarget* target) { ImplicitDependLanguageMap const& implicitLangs = - this->GetImplicitDepends(target); + this->GetImplicitDepends(*target->Target); // list the languages cmakefileStream @@ -2030,7 +2034,7 @@ void cmLocalUnixMakefileGenerator3 // Build a list of preprocessor definitions for the target. std::set defines; - this->AddCompileDefinitions(defines, &target, + this->AddCompileDefinitions(defines, target, this->ConfigName, l->first); if(!defines.empty()) { @@ -2056,12 +2060,10 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; std::vector includes; - cmGeneratorTarget* gt = this->GetGlobalGenerator() - ->GetGeneratorTarget(&target); const std::string& config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GetIncludeDirectories(includes, gt, + this->GetIncludeDirectories(includes, target, l->first, config); for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) @@ -2084,7 +2086,7 @@ void cmLocalUnixMakefileGenerator3 cmSystemTools::ExpandListArgument(xform, transformRules); } if(const char* xform = - target.GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) + target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) { cmSystemTools::ExpandListArgument(xform, transformRules); } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 586dda0..beaddde 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -182,7 +182,8 @@ protected: // write the depend info - void WriteDependLanguageInfo(std::ostream& cmakefileStream, cmTarget &tgt); + void WriteDependLanguageInfo(std::ostream& cmakefileStream, + cmGeneratorTarget *tgt); // write the local help rule void WriteHelpRule(std::ostream& ruleFileStream); @@ -215,12 +216,12 @@ protected: cmCustomCommandGenerator const& cc); void AppendCustomCommands(std::vector& commands, const std::vector& ccs, - cmTarget* target, + cmGeneratorTarget* target, cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT); void AppendCustomCommand(std::vector& commands, cmCustomCommandGenerator const& ccg, - cmTarget* target, + cmGeneratorTarget* target, bool echo_comment=false, cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT, @@ -237,7 +238,7 @@ protected: private: std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root); std::string MakeLauncher(cmCustomCommandGenerator const& ccg, - cmTarget* target, RelativeRoot relative); + cmGeneratorTarget* target, RelativeRoot relative); virtual void ComputeObjectFilenames( std::map& mapping, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 3e901ba..f40e6dd 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1750,12 +1750,12 @@ void cmLocalVisualStudio6Generator flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - this->AddCompileOptions(flags, &target, linkLanguage, ""); - this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug"); - this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release"); - this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage, + this->AddCompileOptions(flags, gt, linkLanguage, ""); + this->AddCompileOptions(flagsDebug, gt, linkLanguage, "Debug"); + this->AddCompileOptions(flagsRelease, gt, linkLanguage, "Release"); + this->AddCompileOptions(flagsMinSizeRel, gt, linkLanguage, "MinSizeRel"); - this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, + this->AddCompileOptions(flagsRelWithDebInfo, gt, linkLanguage, "RelWithDebInfo"); // if _UNICODE and _SBCS are not found, then add -D_MBCS @@ -1775,14 +1775,14 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); - this->AddCompileDefinitions(debugDefinesSet, &target, + this->AddCompileDefinitions(definesSet, gt, "", linkLanguage); + this->AddCompileDefinitions(debugDefinesSet, gt, "DEBUG", linkLanguage); - this->AddCompileDefinitions(releaseDefinesSet, &target, + this->AddCompileDefinitions(releaseDefinesSet, gt, "RELEASE", linkLanguage); - this->AddCompileDefinitions(minsizeDefinesSet, &target, + this->AddCompileDefinitions(minsizeDefinesSet, gt, "MINSIZEREL", linkLanguage); - this->AddCompileDefinitions(debugrelDefinesSet, &target, + this->AddCompileDefinitions(debugrelDefinesSet, gt, "RELWITHDEBINFO", linkLanguage); std::string defines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6d02bfa..485ac31 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -733,7 +733,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } // Add the target-specific flags. - this->AddCompileOptions(flags, &target, linkLanguage, configName); + this->AddCompileOptions(flags, gt, linkLanguage, configName); } if(this->FortranProject) @@ -1152,7 +1152,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } } std::string libflags; - this->GetStaticLibraryFlags(libflags, configTypeUpper, &target); + this->GetStaticLibraryFlags(libflags, configTypeUpper, gt); if(!libflags.empty()) { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 43bc4e1..178b462 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -280,10 +280,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { this->LocalGenerator ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), - this->Target); + this->GeneratorTarget); this->LocalGenerator ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), - this->Target); + this->GeneratorTarget); } // Determine whether a link script will be used. @@ -358,7 +358,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; - vars.CMTarget = this->Target; + vars.CMTarget = this->GeneratorTarget; vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); @@ -449,7 +449,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { this->LocalGenerator-> AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), - this->Target); + this->GeneratorTarget); } // Write the build rule. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 28b4ab8..2ed5f70 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -115,7 +115,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() // Add post-build rules. this->LocalGenerator-> AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), - this->Target); + this->GeneratorTarget); // Depend on the object files. this->AppendObjectDepends(depends); @@ -146,7 +146,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags(extraFlags, - cmSystemTools::UpperCase(this->ConfigName), this->Target); + cmSystemTools::UpperCase(this->ConfigName), this->GeneratorTarget); this->WriteLibraryRules(linkRuleVar, extraFlags, false); } @@ -458,10 +458,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules { this->LocalGenerator ->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), - this->Target); + this->GeneratorTarget); this->LocalGenerator ->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), - this->Target); + this->GeneratorTarget); } // Determine whether a link script will be used. @@ -640,7 +640,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.TargetVersionMinor = targetVersionMinor.c_str(); vars.RuleLauncher = "RULE_LAUNCH_LINK"; - vars.CMTarget = this->Target; + vars.CMTarget = this->GeneratorTarget; vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->GeneratorTarget->GetSupportDirectory(); @@ -811,7 +811,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules { this->LocalGenerator-> AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), - this->Target); + this->GeneratorTarget); } // Compute the list of outputs. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index df50747..b7970fd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -589,7 +589,7 @@ cmMakefileTargetGenerator } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; - vars.CMTarget = this->Target; + vars.CMTarget = this->GeneratorTarget; vars.Language = lang.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); @@ -1040,7 +1040,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() return; } this->LocalGenerator-> - WriteDependLanguageInfo(*this->InfoFileStream,*this->Target); + WriteDependLanguageInfo(*this->InfoFileStream, this->GeneratorTarget); // Store multiple output pairs in the depend info file. if(!this->MultipleOutputPairs.empty()) @@ -1211,7 +1211,8 @@ void cmMakefileTargetGenerator // Now append the actual user-specified commands. std::ostringstream content; - this->LocalGenerator->AppendCustomCommand(commands, ccg, this->Target, false, + this->LocalGenerator->AppendCustomCommand(commands, ccg, + this->GeneratorTarget, false, cmLocalGenerator::HOME_OUTPUT, &content); diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 18594bb..11601c5 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -74,13 +74,13 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() (depends, this->Target->GetPostBuildCommands()); this->LocalGenerator->AppendCustomCommands - (commands, this->Target->GetPreBuildCommands(), this->Target); + (commands, this->Target->GetPreBuildCommands(), this->GeneratorTarget); // Depend on all custom command outputs for sources this->DriveCustomCommands(depends); this->LocalGenerator->AppendCustomCommands - (commands, this->Target->GetPostBuildCommands(), this->Target); + (commands, this->Target->GetPostBuildCommands(), this->GeneratorTarget); // Add dependencies on targets that must be built first. this->AppendTargetDepends(depends); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index e2061e5..e5e4b7f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -178,7 +178,7 @@ cmNinjaNormalTargetGenerator if (!this->GetGlobalGenerator()->HasRule(ruleName)) { cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; - vars.CMTarget = this->GetTarget(); + vars.CMTarget = this->GetGeneratorTarget(); vars.Language = this->TargetLinkLanguage.c_str(); std::string responseFlag; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4d69a5e..cb1122c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -335,7 +335,7 @@ cmNinjaTargetGenerator { cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; - vars.CMTarget = this->GetTarget(); + vars.CMTarget = this->GetGeneratorTarget(); vars.Language = lang.c_str(); vars.Source = "$in"; vars.Object = "$out"; diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 41172f6..386d430 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -120,7 +120,7 @@ static void GetCompileDefinitionsAndDirectories( incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target->Target, config, "CXX"); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f0344bb..2cbd306 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1932,7 +1932,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( { clOptions.AddFlag("CompileAs", "CompileAsCpp"); } - this->LocalGenerator->AddCompileOptions(flags, this->Target, + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, linkLanguage, configName.c_str()); // Get preprocessor definitions for this directory. @@ -2189,7 +2189,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) } std::string libflags; this->LocalGenerator->GetStaticLibraryFlags(libflags, - cmSystemTools::UpperCase(config), this->Target); + cmSystemTools::UpperCase(config), this->GeneratorTarget); if(!libflags.empty()) { this->WriteString("\n", 2); -- cgit v0.12