|
@@ -224,7 +224,7 @@ static bool isSubDirectory(const char* a, const char* b)
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
- cmTarget *target)
|
|
|
+ cmTarget *target, const std::string& prop)
|
|
|
{
|
|
|
const char* installDir =
|
|
|
target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
|
|
@@ -250,20 +250,27 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
std::ostringstream e;
|
|
|
if (genexPos != std::string::npos)
|
|
|
{
|
|
|
- switch (target->GetPolicyStatusCMP0041())
|
|
|
+ if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
|
|
|
{
|
|
|
- case cmPolicies::WARN:
|
|
|
- messageType = cmake::WARNING;
|
|
|
- e << target->GetMakefile()->GetPolicies()
|
|
|
- ->GetPolicyWarning(cmPolicies::CMP0041) << "\n";
|
|
|
- break;
|
|
|
- case cmPolicies::OLD:
|
|
|
- continue;
|
|
|
- case cmPolicies::REQUIRED_IF_USED:
|
|
|
- case cmPolicies::REQUIRED_ALWAYS:
|
|
|
- case cmPolicies::NEW:
|
|
|
- hadFatalError = true;
|
|
|
- break; // Issue fatal message.
|
|
|
+ switch (target->GetPolicyStatusCMP0041())
|
|
|
+ {
|
|
|
+ case cmPolicies::WARN:
|
|
|
+ messageType = cmake::WARNING;
|
|
|
+ e << target->GetMakefile()->GetPolicies()
|
|
|
+ ->GetPolicyWarning(cmPolicies::CMP0041) << "\n";
|
|
|
+ break;
|
|
|
+ case cmPolicies::OLD:
|
|
|
+ continue;
|
|
|
+ case cmPolicies::REQUIRED_IF_USED:
|
|
|
+ case cmPolicies::REQUIRED_ALWAYS:
|
|
|
+ case cmPolicies::NEW:
|
|
|
+ hadFatalError = true;
|
|
|
+ break; // Issue fatal message.
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ hadFatalError = true;
|
|
|
}
|
|
|
}
|
|
|
if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}"))
|
|
@@ -272,8 +279,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
}
|
|
|
if (!cmSystemTools::FileIsFullPath(li->c_str()))
|
|
|
{
|
|
|
- e << "Target \"" << target->GetName() << "\" "
|
|
|
- "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n"
|
|
|
+ e << "Target \"" << target->GetName() << "\" " << prop <<
|
|
|
+ " property contains relative path:\n"
|
|
|
" \"" << *li << "\"";
|
|
|
target->GetMakefile()->IssueMessage(messageType, e.str());
|
|
|
}
|
|
@@ -289,32 +296,35 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
(!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
|
|
|
(!inSource || isSubDirectory(installDir, topSourceDir));
|
|
|
|
|
|
- if (!shouldContinue)
|
|
|
+ if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
|
|
|
{
|
|
|
- switch(target->GetPolicyStatusCMP0052())
|
|
|
+ if (!shouldContinue)
|
|
|
{
|
|
|
- case cmPolicies::WARN:
|
|
|
+ switch(target->GetPolicyStatusCMP0052())
|
|
|
{
|
|
|
- std::ostringstream s;
|
|
|
- s << target->GetMakefile()->GetPolicies()
|
|
|
- ->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
|
|
|
- s << "Directory:\n \"" << *li << "\"\nin "
|
|
|
- "INTERFACE_INCLUDE_DIRECTORIES of target \""
|
|
|
- << target->GetName() << "\" is a subdirectory of the install "
|
|
|
- "directory:\n \"" << installDir << "\"\nhowever it is also "
|
|
|
- "a subdirectory of the " << (inBinary ? "build" : "source")
|
|
|
- << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
|
|
|
- << "\"" << std::endl;
|
|
|
- target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
|
|
|
- s.str());
|
|
|
+ case cmPolicies::WARN:
|
|
|
+ {
|
|
|
+ std::ostringstream s;
|
|
|
+ s << target->GetMakefile()->GetPolicies()
|
|
|
+ ->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
|
|
|
+ s << "Directory:\n \"" << *li << "\"\nin "
|
|
|
+ "INTERFACE_INCLUDE_DIRECTORIES of target \""
|
|
|
+ << target->GetName() << "\" is a subdirectory of the install "
|
|
|
+ "directory:\n \"" << installDir << "\"\nhowever it is also "
|
|
|
+ "a subdirectory of the " << (inBinary ? "build" : "source")
|
|
|
+ << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
|
|
|
+ << "\"" << std::endl;
|
|
|
+ target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
|
|
|
+ s.str());
|
|
|
+ }
|
|
|
+ case cmPolicies::OLD:
|
|
|
+ shouldContinue = true;
|
|
|
+ break;
|
|
|
+ case cmPolicies::REQUIRED_ALWAYS:
|
|
|
+ case cmPolicies::REQUIRED_IF_USED:
|
|
|
+ case cmPolicies::NEW:
|
|
|
+ break;
|
|
|
}
|
|
|
- case cmPolicies::OLD:
|
|
|
- shouldContinue = true;
|
|
|
- break;
|
|
|
- case cmPolicies::REQUIRED_ALWAYS:
|
|
|
- case cmPolicies::REQUIRED_IF_USED:
|
|
|
- case cmPolicies::NEW:
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
if (shouldContinue)
|
|
@@ -324,8 +334,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
}
|
|
|
if (inBinary)
|
|
|
{
|
|
|
- e << "Target \"" << target->GetName() << "\" "
|
|
|
- "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
|
|
|
+ e << "Target \"" << target->GetName() << "\" " << prop <<
|
|
|
+ " property contains path:\n"
|
|
|
" \"" << *li << "\"\nwhich is prefixed in the build directory.";
|
|
|
target->GetMakefile()->IssueMessage(messageType, e.str());
|
|
|
}
|
|
@@ -333,8 +343,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
|
|
{
|
|
|
if (inSource)
|
|
|
{
|
|
|
- e << "Target \"" << target->GetName() << "\" "
|
|
|
- "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
|
|
|
+ e << "Target \"" << target->GetName() << "\" " << prop <<
|
|
|
+ " property contains path:\n"
|
|
|
" \"" << *li << "\"\nwhich is prefixed in the source directory.";
|
|
|
target->GetMakefile()->IssueMessage(messageType, e.str());
|
|
|
}
|
|
@@ -364,6 +374,46 @@ static void prefixItems(std::string &exportDirs)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+void cmExportFileGenerator::PopulateSourcesInterface(
|
|
|
+ cmTargetExport *tei,
|
|
|
+ cmGeneratorExpression::PreprocessContext preprocessRule,
|
|
|
+ ImportPropertyMap &properties,
|
|
|
+ std::vector<std::string> &missingTargets)
|
|
|
+{
|
|
|
+ cmTarget *target = tei->Target;
|
|
|
+ assert(preprocessRule == cmGeneratorExpression::InstallInterface);
|
|
|
+
|
|
|
+ const char *propName = "INTERFACE_SOURCES";
|
|
|
+ const char *input = target->GetProperty(propName);
|
|
|
+
|
|
|
+ if (!input)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!*input)
|
|
|
+ {
|
|
|
+ properties[propName] = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ std::string prepro = cmGeneratorExpression::Preprocess(input,
|
|
|
+ preprocessRule,
|
|
|
+ true);
|
|
|
+ if (!prepro.empty())
|
|
|
+ {
|
|
|
+ this->ResolveTargetsInGeneratorExpressions(prepro, target,
|
|
|
+ missingTargets);
|
|
|
+
|
|
|
+ if (!checkInterfaceDirs(prepro, target, propName))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ properties[propName] = prepro;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//----------------------------------------------------------------------------
|
|
|
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
|
|
cmTargetExport *tei,
|
|
@@ -424,7 +474,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
|
|
this->ResolveTargetsInGeneratorExpressions(prepro, target,
|
|
|
missingTargets);
|
|
|
|
|
|
- if (!checkInterfaceDirs(prepro, target))
|
|
|
+ if (!checkInterfaceDirs(prepro, target, propName))
|
|
|
{
|
|
|
return;
|
|
|
}
|