diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 31 | ||||
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 31 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 28 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 15 | ||||
-rw-r--r-- | Source/cmPolicies.h | 3 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 36 |
7 files changed, 134 insertions, 33 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 5edea86..1feb03a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -412,10 +412,32 @@ struct CompilerIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) + if (strcmp(parameters.begin()->c_str(), compilerId) == 0) { return "1"; } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) + { + switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) + { + case cmPolicies::WARN: + { + cmOStringStream e; + e << context->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0044); + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, + e.str().c_str(), context->Backtrace); + } + case cmPolicies::OLD: + return "1"; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } return "0"; } }; @@ -1024,7 +1046,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), "COMPILE_DEFINITIONS_")) { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + cmPolicies::PolicyStatus polSt = + context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); + if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) + { + interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + } } #undef POPULATE_INTERFACE_PROPERTY_NAME diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 02f00a5..488cc28 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -40,7 +40,36 @@ bool cmGetTargetPropertyCommand cmTarget& target = *tgt; prop = target.GetProperty(args[2].c_str()); } - + else + { + bool issueMessage = false; + cmOStringStream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0045)) + { + case cmPolicies::WARN: + issueMessage = true; + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0045) << "\n"; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + issueMessage = true; + messageType = cmake::FATAL_ERROR; + } + if (issueMessage) + { + e << "get_target_property() called with non-existent target \"" + << targetName << "\"."; + this->Makefile->IssueMessage(messageType, e.str().c_str()); + if (messageType == cmake::FATAL_ERROR) + { + return false; + } + } + } if (prop) { this->Makefile->AddDefinition(var.c_str(), prop); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b8c494f..1c4488f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1334,9 +1334,6 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() const std::vector<cmValueWithOrigin> noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); - std::vector<std::string> configs; - mf->GetConfigurations(configs); - cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) @@ -1357,13 +1354,21 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() t->InsertCompileDefinition(*it); } - for(std::vector<std::string>::const_iterator ci = configs.begin(); - ci != configs.end(); ++ci) + cmPolicies::PolicyStatus polSt + = mf->GetPolicyStatus(cmPolicies::CMP0043); + if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) { - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += cmSystemTools::UpperCase(*ci); - t->AppendProperty(defPropName.c_str(), - mf->GetProperty(defPropName.c_str())); + std::vector<std::string> configs; + mf->GetConfigurations(configs); + + for(std::vector<std::string>::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + t->AppendProperty(defPropName.c_str(), + mf->GetProperty(defPropName.c_str())); + } } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 35b65b4..479e712 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1601,20 +1601,22 @@ void cmMakefile::InitializeFromParent() } // compile definitions property and per-config versions - { - this->SetProperty("COMPILE_DEFINITIONS", - parent->GetProperty("COMPILE_DEFINITIONS")); - std::vector<std::string> configs; - this->GetConfigurations(configs); - for(std::vector<std::string>::const_iterator ci = configs.begin(); - ci != configs.end(); ++ci) - { - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += cmSystemTools::UpperCase(*ci); - this->SetProperty(defPropName.c_str(), - parent->GetProperty(defPropName.c_str())); + cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043); + if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) + { + this->SetProperty("COMPILE_DEFINITIONS", + parent->GetProperty("COMPILE_DEFINITIONS")); + std::vector<std::string> configs; + this->GetConfigurations(configs); + for(std::vector<std::string>::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + const char* prop = parent->GetProperty(defPropName.c_str()); + this->SetProperty(defPropName.c_str(), prop); + } } - } // link libraries this->LinkLibraries = parent->LinkLibraries; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 987c663..5a189f8 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -316,6 +316,21 @@ cmPolicies::cmPolicies() CMP0042, "CMP0042", "MACOSX_RPATH is enabled by default.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0043, "CMP0043", + "Ignore COMPILE_DEFINITIONS_<Config> properties.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0044, "CMP0044", + "Case sensitive <LANG>_COMPILER_ID generator expressions.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0045, "CMP0045", + "Error on non-existent target in get_target_property.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 66eaf87..b1342bf 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -96,6 +96,9 @@ public: /// add_custom_command() must exist. CMP0041, ///< Error on relative include with generator expression CMP0042, ///< Enable MACOSX_RPATH by default + CMP0043, ///< Ignore COMPILE_DEFINITIONS_<Config> properties + CMP0044, ///< Case sensitive <LANG>_COMPILER_ID generator expressions + CMP0045, ///< Error on non-existent target in get_target_property /** \brief Always the last entry. * diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b06480b..a8468ef 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2209,14 +2209,34 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, std::string configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); const char *configProp = this->GetProperty(configPropName.c_str()); - std::string defsString = (configProp ? configProp : ""); - - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(defsString); - this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + if (configProp) + { + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) + { + case cmPolicies::WARN: + { + cmOStringStream e; + e << this->Makefile->GetCMakeInstance()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0043); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + e.str().c_str()); + } + case cmPolicies::OLD: + { + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(configProp); + this->Internal + ->CachedLinkInterfaceCompileDefinitionsEntries[configString] + .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } } } |