cmLocalGenerator: Port some API to cmGeneratorTarget.
This commit is contained in:
parent
cfb2f7508a
commit
3e8ef64273
|
@ -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;
|
||||
|
|
|
@ -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_";
|
||||
|
|
|
@ -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<std::string, std::string>::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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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<std::string>& defines,
|
||||
cmTarget const* target,
|
||||
cmGeneratorTarget const* target,
|
||||
const std::string& config,
|
||||
const std::string& lang)
|
||||
{
|
||||
std::vector<std::string> 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<std::string>::const_iterator i = opts.begin();
|
||||
i != opts.end(); ++i)
|
||||
{
|
||||
|
@ -1139,7 +1136,7 @@ void cmLocalGenerator::AddCompileOptions(
|
|||
this->AppendFlags(flags, targetFlags);
|
||||
}
|
||||
std::vector<std::string> opts;
|
||||
gtgt->GetCompileOptions(opts, config, lang);
|
||||
target->GetCompileOptions(opts, config, lang);
|
||||
for(std::vector<std::string>::const_iterator i = opts.begin();
|
||||
i != opts.end(); ++i)
|
||||
{
|
||||
|
@ -1148,19 +1145,19 @@ void cmLocalGenerator::AddCompileOptions(
|
|||
}
|
||||
}
|
||||
std::vector<std::string> features;
|
||||
gtgt->GetCompileFeatures(features, config);
|
||||
target->GetCompileFeatures(features, config);
|
||||
for(std::vector<std::string>::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<std::string, std::string>::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<std::string>& 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))
|
||||
{
|
||||
|
|
|
@ -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<std::string>& 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.
|
||||
|
|
|
@ -1034,7 +1034,7 @@ void
|
|||
cmLocalUnixMakefileGenerator3
|
||||
::AppendCustomCommands(std::vector<std::string>& commands,
|
||||
const std::vector<cmCustomCommand>& ccs,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
cmLocalGenerator::RelativeRoot relative)
|
||||
{
|
||||
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
|
||||
|
@ -1050,7 +1050,7 @@ void
|
|||
cmLocalUnixMakefileGenerator3
|
||||
::AppendCustomCommand(std::vector<std::string>& 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<std::string> 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<std::string> 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<std::string>::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);
|
||||
}
|
||||
|
|
|
@ -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<std::string>& commands,
|
||||
const std::vector<cmCustomCommand>& ccs,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
cmLocalGenerator::RelativeRoot relative =
|
||||
cmLocalGenerator::HOME_OUTPUT);
|
||||
void AppendCustomCommand(std::vector<std::string>& 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<cmSourceFile const*, std::string>& mapping,
|
||||
|
|
|
@ -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<std::string> minsizeDefinesSet;
|
||||
std::set<std::string> 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 = " ";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -120,7 +120,7 @@ static void GetCompileDefinitionsAndDirectories(
|
|||
incs = cmJoin(includeDirs, ";");
|
||||
|
||||
std::set<std::string> defines;
|
||||
localGen->AddCompileDefinitions(defines, target->Target, config, "CXX");
|
||||
localGen->AddCompileDefinitions(defines, target, config, "CXX");
|
||||
|
||||
defs += cmJoin(defines, ";");
|
||||
}
|
||||
|
|
|
@ -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("<Lib>\n", 2);
|
||||
|
|
Loading…
Reference in New Issue