export: Port internal method to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-07 00:44:06 +02:00
parent 53d3a1c95a
commit e46ef270ed
1 changed files with 14 additions and 12 deletions

View File

@ -241,12 +241,12 @@ static bool isSubDirectory(const char* a, const char* b)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool checkInterfaceDirs(const std::string &prepro, static bool checkInterfaceDirs(const std::string &prepro,
cmTarget *target, const std::string& prop) cmGeneratorTarget *target, const std::string& prop)
{ {
const char* installDir = const char* installDir =
target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
const char* topSourceDir = target->GetMakefile()->GetHomeDirectory(); const char* topSourceDir = target->Makefile->GetHomeDirectory();
const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory(); const char* topBinaryDir = target->Makefile->GetHomeOutputDirectory();
std::vector<std::string> parts; std::vector<std::string> parts;
cmGeneratorExpression::Split(prepro, parts); cmGeneratorExpression::Split(prepro, parts);
@ -269,7 +269,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (prop == "INTERFACE_INCLUDE_DIRECTORIES") if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{ {
switch (target->GetPolicyStatusCMP0041()) switch (target->Target->GetPolicyStatusCMP0041())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
messageType = cmake::WARNING; messageType = cmake::WARNING;
@ -298,7 +298,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains relative path:\n" " property contains relative path:\n"
" \"" << *li << "\""; " \"" << *li << "\"";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
bool inBinary = isSubDirectory(li->c_str(), topBinaryDir); bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
bool inSource = isSubDirectory(li->c_str(), topSourceDir); bool inSource = isSubDirectory(li->c_str(), topSourceDir);
@ -316,7 +316,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (!shouldContinue) if (!shouldContinue)
{ {
switch(target->GetPolicyStatusCMP0052()) switch(target->Target->GetPolicyStatusCMP0052())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -329,7 +329,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
"a subdirectory of the " << (inBinary ? "build" : "source") "a subdirectory of the " << (inBinary ? "build" : "source")
<< " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
<< "\"" << std::endl; << "\"" << std::endl;
target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING,
s.str()); s.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -352,7 +352,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n" " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory."; " \"" << *li << "\"\nwhich is prefixed in the build directory.";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
if (!inSourceBuild) if (!inSourceBuild)
{ {
@ -361,7 +361,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n" " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the source directory."; " \"" << *li << "\"\nwhich is prefixed in the source directory.";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
} }
} }
@ -421,7 +421,9 @@ void cmExportFileGenerator::PopulateSourcesInterface(
this->ResolveTargetsInGeneratorExpressions(prepro, target, this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets); missingTargets);
if (!checkInterfaceDirs(prepro, target, propName)) cmGeneratorTarget* gt = target->GetMakefile()
->GetGlobalGenerator()->GetGeneratorTarget(target);
if (!checkInterfaceDirs(prepro, gt, propName))
{ {
return; return;
} }
@ -491,7 +493,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets); missingTargets);
if (!checkInterfaceDirs(prepro, target->Target, propName)) if (!checkInterfaceDirs(prepro, target, propName))
{ {
return; return;
} }