|
|
@@ -136,7 +136,7 @@ public:
|
|
|
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
|
|
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
|
|
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
|
|
- std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
|
|
|
+ std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
|
|
|
|
|
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
|
|
|
CachedLinkInterfaceIncludeDirectoriesEntries;
|
|
|
@@ -330,34 +330,36 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|
|
// Save the backtrace of target construction.
|
|
|
this->Makefile->GetBacktrace(this->Internal->Backtrace);
|
|
|
|
|
|
- // Initialize the INCLUDE_DIRECTORIES property based on the current value
|
|
|
- // of the same directory property:
|
|
|
- const std::vector<cmValueWithOrigin> parentIncludes =
|
|
|
- this->Makefile->GetIncludeDirectoriesEntries();
|
|
|
-
|
|
|
- for (std::vector<cmValueWithOrigin>::const_iterator it
|
|
|
- = parentIncludes.begin(); it != parentIncludes.end(); ++it)
|
|
|
+ if (!this->IsImported())
|
|
|
{
|
|
|
- this->InsertInclude(*it);
|
|
|
- }
|
|
|
+ // Initialize the INCLUDE_DIRECTORIES property based on the current value
|
|
|
+ // of the same directory property:
|
|
|
+ const std::vector<cmValueWithOrigin> parentIncludes =
|
|
|
+ this->Makefile->GetIncludeDirectoriesEntries();
|
|
|
|
|
|
- const std::set<cmStdString> parentSystemIncludes =
|
|
|
- this->Makefile->GetSystemIncludeDirectories();
|
|
|
+ for (std::vector<cmValueWithOrigin>::const_iterator it
|
|
|
+ = parentIncludes.begin(); it != parentIncludes.end(); ++it)
|
|
|
+ {
|
|
|
+ this->InsertInclude(*it);
|
|
|
+ }
|
|
|
+ const std::set<cmStdString> parentSystemIncludes =
|
|
|
+ this->Makefile->GetSystemIncludeDirectories();
|
|
|
|
|
|
- for (std::set<cmStdString>::const_iterator it
|
|
|
- = parentSystemIncludes.begin();
|
|
|
- it != parentSystemIncludes.end(); ++it)
|
|
|
- {
|
|
|
- this->SystemIncludeDirectories.insert(*it);
|
|
|
- }
|
|
|
+ for (std::set<cmStdString>::const_iterator it
|
|
|
+ = parentSystemIncludes.begin();
|
|
|
+ it != parentSystemIncludes.end(); ++it)
|
|
|
+ {
|
|
|
+ this->SystemIncludeDirectories.insert(*it);
|
|
|
+ }
|
|
|
|
|
|
- const std::vector<cmValueWithOrigin> parentOptions =
|
|
|
- this->Makefile->GetCompileOptionsEntries();
|
|
|
+ const std::vector<cmValueWithOrigin> parentOptions =
|
|
|
+ this->Makefile->GetCompileOptionsEntries();
|
|
|
|
|
|
- for (std::vector<cmValueWithOrigin>::const_iterator it
|
|
|
- = parentOptions.begin(); it != parentOptions.end(); ++it)
|
|
|
- {
|
|
|
- this->InsertCompileOption(*it);
|
|
|
+ for (std::vector<cmValueWithOrigin>::const_iterator it
|
|
|
+ = parentOptions.begin(); it != parentOptions.end(); ++it)
|
|
|
+ {
|
|
|
+ this->InsertCompileOption(*it);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (this->GetType() != INTERFACE_LIBRARY)
|
|
|
@@ -1042,8 +1044,8 @@ cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
|
|
|
void cmTarget::FinalizeSystemIncludeDirectories()
|
|
|
{
|
|
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
|
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
|
|
|
- end = this->Internal->LinkInterfacePropertyEntries.end();
|
|
|
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
|
+ end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
|
it != end; ++it)
|
|
|
{
|
|
|
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
|
|
|
@@ -1495,11 +1497,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
|
|
|
}
|
|
|
if (strcmp(prop, "LINK_LIBRARIES") == 0)
|
|
|
{
|
|
|
- this->Internal->LinkInterfacePropertyEntries.clear();
|
|
|
+ this->Internal->LinkImplementationPropertyEntries.clear();
|
|
|
cmListFileBacktrace lfbt;
|
|
|
this->Makefile->GetBacktrace(lfbt);
|
|
|
cmValueWithOrigin entry(value, lfbt);
|
|
|
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
|
|
|
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
|
|
|
return;
|
|
|
}
|
|
|
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
|
|
|
@@ -1570,7 +1572,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
|
|
|
cmListFileBacktrace lfbt;
|
|
|
this->Makefile->GetBacktrace(lfbt);
|
|
|
cmValueWithOrigin entry(value, lfbt);
|
|
|
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
|
|
|
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
|
|
|
return;
|
|
|
}
|
|
|
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
|
|
|
@@ -1882,8 +1884,8 @@ cmTarget::GetIncludeDirectories(const char *config) const
|
|
|
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
|
|
|
{
|
|
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
|
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
|
|
|
- end = this->Internal->LinkInterfacePropertyEntries.end();
|
|
|
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
|
+ end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
|
it != end; ++it)
|
|
|
{
|
|
|
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
|
|
|
@@ -2111,8 +2113,8 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
|
|
|
if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString])
|
|
|
{
|
|
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
|
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
|
|
|
- end = this->Internal->LinkInterfacePropertyEntries.end();
|
|
|
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
|
+ end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
|
it != end; ++it)
|
|
|
{
|
|
|
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
|
|
|
@@ -2224,8 +2226,8 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
|
|
|
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
|
|
|
{
|
|
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
|
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
|
|
|
- end = this->Internal->LinkInterfacePropertyEntries.end();
|
|
|
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
|
+ end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
|
it != end; ++it)
|
|
|
{
|
|
|
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
|
|
|
@@ -2720,25 +2722,6 @@ const char *cmTarget::GetProperty(const char* prop,
|
|
|
this->GetLocation(configName.c_str()),
|
|
|
cmProperty::TARGET);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- // Support "<CONFIG>_LOCATION" for compatibility.
|
|
|
- int len = static_cast<int>(strlen(prop));
|
|
|
- if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
|
|
|
- {
|
|
|
- std::string configName(prop, len-9);
|
|
|
- if(configName != "IMPORTED")
|
|
|
- {
|
|
|
- if (!this->HandleLocationPropertyPolicy())
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- this->Properties.SetProperty(prop,
|
|
|
- this->GetLocation(configName.c_str()),
|
|
|
- cmProperty::TARGET);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
|
|
|
{
|
|
|
@@ -2800,8 +2783,8 @@ const char *cmTarget::GetProperty(const char* prop,
|
|
|
output = "";
|
|
|
std::string sep;
|
|
|
for (std::vector<cmValueWithOrigin>::const_iterator
|
|
|
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
|
|
|
- end = this->Internal->LinkInterfacePropertyEntries.end();
|
|
|
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
|
|
|
+ end = this->Internal->LinkImplementationPropertyEntries.end();
|
|
|
it != end; ++it)
|
|
|
{
|
|
|
output += sep;
|
|
|
@@ -4257,20 +4240,23 @@ enum CompatibleType
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
template<typename PropertyType>
|
|
|
-PropertyType consistentProperty(PropertyType lhs, PropertyType rhs,
|
|
|
- CompatibleType t);
|
|
|
+std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
|
|
|
+ PropertyType rhs,
|
|
|
+ CompatibleType t);
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
template<>
|
|
|
-bool consistentProperty(bool lhs, bool rhs, CompatibleType)
|
|
|
+std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
|
|
|
{
|
|
|
- return lhs == rhs;
|
|
|
+ return std::make_pair(lhs == rhs, lhs);
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
-const char * consistentStringProperty(const char *lhs, const char *rhs)
|
|
|
+std::pair<bool, const char*> consistentStringProperty(const char *lhs,
|
|
|
+ const char *rhs)
|
|
|
{
|
|
|
- return strcmp(lhs, rhs) == 0 ? lhs : 0;
|
|
|
+ const bool b = strcmp(lhs, rhs) == 0;
|
|
|
+ return std::make_pair(b, b ? lhs : 0);
|
|
|
}
|
|
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER <= 1200
|
|
|
@@ -4284,49 +4270,69 @@ cmMinimum(const T& l, const T& r) {return l < r ? l : r;}
|
|
|
#endif
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
-const char * consistentNumberProperty(const char *lhs, const char *rhs,
|
|
|
- CompatibleType t)
|
|
|
+std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
|
|
|
+ const char *rhs,
|
|
|
+ CompatibleType t)
|
|
|
{
|
|
|
+
|
|
|
+#if defined(_MSC_VER)
|
|
|
+ static const char* const null_ptr = 0;
|
|
|
+#else
|
|
|
+# define null_ptr 0
|
|
|
+#endif
|
|
|
+
|
|
|
double lnum;
|
|
|
double rnum;
|
|
|
if(sscanf(lhs, "%lg", &lnum) != 1 ||
|
|
|
sscanf(rhs, "%lg", &rnum) != 1)
|
|
|
{
|
|
|
- return 0;
|
|
|
+ return std::pair<bool, const char*>(false, null_ptr);
|
|
|
}
|
|
|
|
|
|
+#if !defined(_MSC_VER)
|
|
|
+#undef null_ptr
|
|
|
+#endif
|
|
|
+
|
|
|
if (t == NumberMaxType)
|
|
|
{
|
|
|
- return cmMaximum(lnum, rnum) == lnum ? lhs : rhs;
|
|
|
+ return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return cmMinimum(lnum, rnum) == lnum ? lhs : rhs;
|
|
|
+ return std::make_pair(true, cmMinimum(lnum, rnum) == lnum ? lhs : rhs);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
template<>
|
|
|
-const char* consistentProperty(const char *lhs, const char *rhs,
|
|
|
- CompatibleType t)
|
|
|
+std::pair<bool, const char*> consistentProperty(const char *lhs,
|
|
|
+ const char *rhs,
|
|
|
+ CompatibleType t)
|
|
|
{
|
|
|
if (!lhs && !rhs)
|
|
|
{
|
|
|
- return "";
|
|
|
+ return std::make_pair(true, lhs);
|
|
|
}
|
|
|
if (!lhs)
|
|
|
{
|
|
|
- return rhs ? rhs : "";
|
|
|
+ return std::make_pair(true, rhs);
|
|
|
}
|
|
|
if (!rhs)
|
|
|
{
|
|
|
- return lhs ? lhs : "";
|
|
|
+ return std::make_pair(true, lhs);
|
|
|
}
|
|
|
+
|
|
|
+#if defined(_MSC_VER)
|
|
|
+ static const char* const null_ptr = 0;
|
|
|
+#else
|
|
|
+# define null_ptr 0
|
|
|
+#endif
|
|
|
+
|
|
|
switch(t)
|
|
|
{
|
|
|
case BoolType:
|
|
|
assert(!"consistentProperty for strings called with BoolType");
|
|
|
- return 0;
|
|
|
+ return std::pair<bool, const char*>(false, null_ptr);
|
|
|
case StringType:
|
|
|
return consistentStringProperty(lhs, rhs);
|
|
|
case NumberMinType:
|
|
|
@@ -4334,7 +4340,12 @@ const char* consistentProperty(const char *lhs, const char *rhs,
|
|
|
return consistentNumberProperty(lhs, rhs, t);
|
|
|
}
|
|
|
assert(!"Unreachable!");
|
|
|
- return 0;
|
|
|
+ return std::pair<bool, const char*>(false, null_ptr);
|
|
|
+
|
|
|
+#if !defined(_MSC_VER)
|
|
|
+#undef null_ptr
|
|
|
+#endif
|
|
|
+
|
|
|
}
|
|
|
|
|
|
template<typename PropertyType>
|
|
|
@@ -4506,7 +4517,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
("INTERFACE_" + p).c_str(), 0);
|
|
|
|
|
|
std::string reportEntry;
|
|
|
- if (ifacePropContent)
|
|
|
+ if (ifaceIsSet)
|
|
|
{
|
|
|
reportEntry += " * Target \"";
|
|
|
reportEntry += li->Target->GetName();
|
|
|
@@ -4519,11 +4530,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
{
|
|
|
if (ifaceIsSet)
|
|
|
{
|
|
|
- PropertyType consistent = consistentProperty(propContent,
|
|
|
+ std::pair<bool, PropertyType> consistent =
|
|
|
+ consistentProperty(propContent,
|
|
|
ifacePropContent, t);
|
|
|
report += reportEntry;
|
|
|
- report += compatibilityAgree(t, propContent != consistent);
|
|
|
- if (!consistent)
|
|
|
+ report += compatibilityAgree(t, propContent != consistent.second);
|
|
|
+ if (!consistent.first)
|
|
|
{
|
|
|
cmOStringStream e;
|
|
|
e << "Property " << p << " on target \""
|
|
|
@@ -4535,7 +4547,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- propContent = consistent;
|
|
|
+ propContent = consistent.second;
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -4549,19 +4561,14 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
{
|
|
|
propContent = impliedValue<PropertyType>(propContent);
|
|
|
|
|
|
- reportEntry += " * Target \"";
|
|
|
- reportEntry += li->Target->GetName();
|
|
|
- reportEntry += "\" property value \"";
|
|
|
- reportEntry += valueAsString<PropertyType>(propContent);
|
|
|
- reportEntry += "\" ";
|
|
|
-
|
|
|
if (ifaceIsSet)
|
|
|
{
|
|
|
- PropertyType consistent = consistentProperty(propContent,
|
|
|
+ std::pair<bool, PropertyType> consistent =
|
|
|
+ consistentProperty(propContent,
|
|
|
ifacePropContent, t);
|
|
|
report += reportEntry;
|
|
|
- report += compatibilityAgree(t, propContent != consistent);
|
|
|
- if (!consistent)
|
|
|
+ report += compatibilityAgree(t, propContent != consistent.second);
|
|
|
+ if (!consistent.first)
|
|
|
{
|
|
|
cmOStringStream e;
|
|
|
e << "Property " << p << " on target \""
|
|
|
@@ -4574,7 +4581,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- propContent = consistent;
|
|
|
+ propContent = consistent.second;
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -4590,11 +4597,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
{
|
|
|
if (propInitialized)
|
|
|
{
|
|
|
- PropertyType consistent = consistentProperty(propContent,
|
|
|
+ std::pair<bool, PropertyType> consistent =
|
|
|
+ consistentProperty(propContent,
|
|
|
ifacePropContent, t);
|
|
|
report += reportEntry;
|
|
|
- report += compatibilityAgree(t, propContent != consistent);
|
|
|
- if (!consistent)
|
|
|
+ report += compatibilityAgree(t, propContent != consistent.second);
|
|
|
+ if (!consistent.first)
|
|
|
{
|
|
|
cmOStringStream e;
|
|
|
e << "The INTERFACE_" << p << " property of \""
|
|
|
@@ -4606,7 +4614,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- propContent = consistent;
|
|
|
+ propContent = consistent.second;
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -6003,7 +6011,8 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
|
|
|
<< propsString <<
|
|
|
" property in the dependencies of target \"" << this->GetName() <<
|
|
|
"\". This is not allowed. A property may only require compatibility "
|
|
|
- "in a boolean interpretation or a string interpretation, but not both.";
|
|
|
+ "in a boolean interpretation, a numeric minimum, a numeric maximum or a "
|
|
|
+ "string interpretation, but not a mixture.";
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
}
|
|
|
}
|