Access policy status from cmGeneratorTarget at generate time.

This commit is contained in:
Stephen Kelly 2015-10-20 01:12:37 +02:00
parent d74bca5a8f
commit c099e00fc0
7 changed files with 29 additions and 31 deletions

View File

@ -407,7 +407,7 @@ cmComputeLinkInformation
// order to support such projects we need to add the directories // order to support such projects we need to add the directories
// containing libraries linked with a full path to the -L path. // containing libraries linked with a full path to the -L path.
this->OldLinkDirMode = this->OldLinkDirMode =
this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW; this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
if(this->OldLinkDirMode) if(this->OldLinkDirMode)
{ {
// Construct a mask to not bother with this behavior for link // Construct a mask to not bother with this behavior for link
@ -1140,7 +1140,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// Full path libraries should specify a valid library file name. // Full path libraries should specify a valid library file name.
// See documentation of CMP0008. // See documentation of CMP0008.
std::string generator = this->GlobalGenerator->GetName(); std::string generator = this->GlobalGenerator->GetName();
if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
(generator.find("Visual Studio") != generator.npos || (generator.find("Visual Studio") != generator.npos ||
generator.find("Xcode") != generator.npos)) generator.find("Xcode") != generator.npos))
{ {
@ -1221,7 +1221,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
} }
// Check the policy for whether we should use the approach below. // Check the policy for whether we should use the approach below.
switch (this->Target->Target->GetPolicyStatusCMP0060()) switch (this->Target->GetPolicyStatusCMP0060())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
if (this->CMP0060Warn) if (this->CMP0060Warn)
@ -1531,7 +1531,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
this->OrderLinkerSearchPath->AddLinkLibrary(item); this->OrderLinkerSearchPath->AddLinkLibrary(item);
// Produce any needed message. // Produce any needed message.
switch(this->Target->Target->GetPolicyStatusCMP0008()) switch(this->Target->GetPolicyStatusCMP0008())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -1583,7 +1583,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
} }
// Enforce policy constraints. // Enforce policy constraints.
switch(this->Target->Target->GetPolicyStatusCMP0003()) switch(this->Target->GetPolicyStatusCMP0003())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
if(!this->CMakeInstance->GetState() if(!this->CMakeInstance->GetState()

View File

@ -362,7 +362,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmake::MessageType messageType = cmake::AUTHOR_WARNING; cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false; bool issueMessage = false;
std::ostringstream e; std::ostringstream e;
switch(depender->Target->GetPolicyStatusCMP0046()) switch(depender->GetPolicyStatusCMP0046())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";

View File

@ -107,8 +107,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
gte, properties); gte, properties);
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
gte->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN gte->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& gte->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD; && gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) if (newCMP0022Behavior)
{ {
this->PopulateInterfaceLinkLibrariesProperty(gte, this->PopulateInterfaceLinkLibrariesProperty(gte,

View File

@ -270,7 +270,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (prop == "INTERFACE_INCLUDE_DIRECTORIES") if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{ {
switch (target->Target->GetPolicyStatusCMP0041()) switch (target->GetPolicyStatusCMP0041())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
messageType = cmake::WARNING; messageType = cmake::WARNING;
@ -317,7 +317,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (!shouldContinue) if (!shouldContinue)
{ {
switch(target->Target->GetPolicyStatusCMP0052()) switch(target->GetPolicyStatusCMP0052())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -830,10 +830,8 @@ cmExportFileGenerator
} }
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
target->Target target->GetPolicyStatusCMP0022() != cmPolicies::WARN
->GetPolicyStatusCMP0022() != cmPolicies::WARN && target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
&& target->Target
->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(newCMP0022Behavior && !this->ExportOld) if(newCMP0022Behavior && !this->ExportOld)
{ {

View File

@ -169,8 +169,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
properties, missingTargets); properties, missingTargets);
const bool newCMP0022Behavior = const bool newCMP0022Behavior =
gt->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN gt->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& gt->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD; && gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) if (newCMP0022Behavior)
{ {
if (this->PopulateInterfaceLinkLibrariesProperty(gt, if (this->PopulateInterfaceLinkLibrariesProperty(gt,

View File

@ -1498,7 +1498,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
return this->GetPropertyAsBool("MACOSX_RPATH"); return this->GetPropertyAsBool("MACOSX_RPATH");
} }
cmPolicies::PolicyStatus cmp0042 = this->Target->GetPolicyStatusCMP0042(); cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
if(cmp0042 == cmPolicies::WARN) if(cmp0042 == cmPolicies::WARN)
{ {
@ -2635,7 +2635,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
if (checkCMP0027) if (checkCMP0027)
{ {
switch(tgt->Target->GetPolicyStatusCMP0027()) switch(tgt->GetPolicyStatusCMP0027())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n"; e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
@ -2674,7 +2674,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
} }
else else
{ {
switch(tgt->Target->GetPolicyStatusCMP0021()) switch(tgt->GetPolicyStatusCMP0021())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -4706,8 +4706,8 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
} }
} }
} }
else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
|| this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD) || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
{ {
// The link implementation is the default link interface. // The link implementation is the default link interface.
cmLinkImplementationLibraries const* cmLinkImplementationLibraries const*
@ -5075,8 +5075,8 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// libraries and executables that export symbols. // libraries and executables that export symbols.
const char* explicitLibraries = 0; const char* explicitLibraries = 0;
std::string linkIfaceProp; std::string linkIfaceProp;
if(this->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD && if(this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
this->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN) this->GetPolicyStatusCMP0022() != cmPolicies::WARN)
{ {
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
@ -5102,7 +5102,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
} }
if(explicitLibraries && if(explicitLibraries &&
this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN && this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022) !this->PolicyWarnedCMP0022)
{ {
// Compare the explicitly set old link interface properties to the // Compare the explicitly set old link interface properties to the
@ -5147,8 +5147,8 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
iface.Libraries, iface.Libraries,
iface.HadHeadSensitiveCondition); iface.HadHeadSensitiveCondition);
} }
else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
|| this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD) || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
// If CMP0022 is NEW then the plain tll signature sets the // If CMP0022 is NEW then the plain tll signature sets the
// INTERFACE_LINK_LIBRARIES, so if we get here then the project // INTERFACE_LINK_LIBRARIES, so if we get here then the project
// cleared the property explicitly and we should not fall back // cleared the property explicitly and we should not fall back
@ -5159,7 +5159,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
this->GetLinkImplementationLibrariesInternal(config, headTarget); this->GetLinkImplementationLibrariesInternal(config, headTarget);
iface.Libraries.insert(iface.Libraries.end(), iface.Libraries.insert(iface.Libraries.end(),
impl->Libraries.begin(), impl->Libraries.end()); impl->Libraries.begin(), impl->Libraries.end());
if(this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN && if(this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && !usage_requirements_only) !this->PolicyWarnedCMP0022 && !usage_requirements_only)
{ {
// Compare the link implementation fallback link interface to the // Compare the link implementation fallback link interface to the
@ -5621,7 +5621,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
if(lib != item) if(lib != item)
{ {
cmake* cm = this->LocalGenerator->GetCMakeInstance(); cmake* cm = this->LocalGenerator->GetCMakeInstance();
switch(this->Target->GetPolicyStatusCMP0004()) switch(this->GetPolicyStatusCMP0004())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -5829,7 +5829,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
bool noMessage = false; bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
std::ostringstream e; std::ostringstream e;
switch(this->Target->GetPolicyStatusCMP0038()) switch(this->GetPolicyStatusCMP0038())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {

View File

@ -1551,7 +1551,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS"))
{ {
bool add_shlib_flags = false; bool add_shlib_flags = false;
switch(tgt.Target->GetPolicyStatusCMP0065()) switch(tgt.GetPolicyStatusCMP0065())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") && if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
@ -2108,7 +2108,7 @@ void cmLocalGenerator
target->GetType() != cmState::MODULE_LIBRARY && target->GetType() != cmState::MODULE_LIBRARY &&
!target->IsExecutableWithExports()) !target->IsExecutableWithExports())
{ {
switch (target->Target->GetPolicyStatusCMP0063()) switch (target->GetPolicyStatusCMP0063())
{ {
case cmPolicies::OLD: case cmPolicies::OLD:
return; return;