diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-03-26 17:08:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-05-21 18:59:17 (GMT) |
commit | eabefa8b02b399b00aea83185b6b364ab5b6aa3d (patch) | |
tree | d704dd000578415ab3be7b88248488d4d06caf73 /Source/cmTarget.cxx | |
parent | 272431a84ff13eb17cf04389428f57c7fe13e3a2 (diff) | |
download | CMake-eabefa8b02b399b00aea83185b6b364ab5b6aa3d.zip CMake-eabefa8b02b399b00aea83185b6b364ab5b6aa3d.tar.gz CMake-eabefa8b02b399b00aea83185b6b364ab5b6aa3d.tar.bz2 |
Error on relative path in INCLUDE_DIRECTORIES target property.
Add policy CMP0021 to preserve existing behavior in projects expecting
it from earlier CMake versions.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d14bfca..fab8f19 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -191,6 +191,7 @@ cmTarget::cmTarget() this->PolicyStatusCMP0004 = cmPolicies::WARN; this->PolicyStatusCMP0008 = cmPolicies::WARN; this->PolicyStatusCMP0020 = cmPolicies::WARN; + this->PolicyStatusCMP0021 = cmPolicies::WARN; this->LinkLibrariesAnalyzed = false; this->HaveInstallRule = false; this->DLLPlatform = false; @@ -1568,6 +1569,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->Makefile->GetPolicyStatus(cmPolicies::CMP0008); this->PolicyStatusCMP0020 = this->Makefile->GetPolicyStatus(cmPolicies::CMP0020); + this->PolicyStatusCMP0021 = + this->Makefile->GetPolicyStatus(cmPolicies::CMP0021); } //---------------------------------------------------------------------------- @@ -2876,14 +2879,41 @@ static void processIncludeDirectories(cmTarget *tgt, if (!cmSystemTools::FileIsFullPath(li->c_str())) { + cmOStringStream e; + bool noMessage = false; + cmake::MessageType messageType = cmake::FATAL_ERROR; if (!(*it)->TargetName.empty()) { - cmOStringStream e; e << "Target \"" << (*it)->TargetName << "\" contains relative " "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" " \"" << *li << "\" "; - tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, - e.str().c_str()); + } + else + { + switch(tgt->GetPolicyStatusCMP0021()) + { + case cmPolicies::WARN: + { + cmOStringStream w; + e << (mf->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n"; + messageType = cmake::AUTHOR_WARNING; + } + break; + case cmPolicies::OLD: + noMessage = true; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Issue the fatal message. + break; + } + e << "Found relative path while evaluating include directories of " + "\"" << tgt->GetName() << "\":\n \"" << *li << "\"\n"; + } + if (!noMessage) + { + tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); return; } } |