diff options
author | Brad King <brad.king@kitware.com> | 2013-05-21 19:13:26 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-05-21 19:13:26 (GMT) |
commit | 5947d039873606fbc6ce854afb16a5db09b1736c (patch) | |
tree | 6fa391c8dd4250357c59ebb5763e7beea5c76bfe /Source/cmTarget.cxx | |
parent | 484112d045a2b22b1d336f1d1043f0f6e2a340f0 (diff) | |
parent | eabefa8b02b399b00aea83185b6b364ab5b6aa3d (diff) | |
download | CMake-5947d039873606fbc6ce854afb16a5db09b1736c.zip CMake-5947d039873606fbc6ce854afb16a5db09b1736c.tar.gz CMake-5947d039873606fbc6ce854afb16a5db09b1736c.tar.bz2 |
Merge topic 'error-on-exported-missing-include-dir'
eabefa8 Error on relative path in INCLUDE_DIRECTORIES target property.
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 ed8edcc..e0807a8 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; } } |