diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:45 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:45 +0900 |
commit | fa10a4a91520c9add2283a053dd755a7e5db9f4b (patch) | |
tree | b4c33311cdf36a37e72e3c4bd013e59b42a815f6 /Source/cmCMakePolicyCommand.cxx | |
parent | 4ca455f44f42bf3257fe1ce752ca7447e9568a27 (diff) | |
download | cmake-fa10a4a91520c9add2283a053dd755a7e5db9f4b.tar.gz cmake-fa10a4a91520c9add2283a053dd755a7e5db9f4b.tar.bz2 cmake-fa10a4a91520c9add2283a053dd755a7e5db9f4b.zip |
Imported Upstream version 3.14.1upstream/3.14.1
Diffstat (limited to 'Source/cmCMakePolicyCommand.cxx')
-rw-r--r-- | Source/cmCMakePolicyCommand.cxx | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index adf9ef80e..ac30e1a39 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -5,10 +5,10 @@ #include <sstream> #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmPolicies.h" #include "cmState.h" #include "cmStateTypes.h" -#include "cmake.h" class cmExecutionStatus; @@ -46,6 +46,9 @@ bool cmCMakePolicyCommand::InitialPass(std::vector<std::string> const& args, if (args[0] == "VERSION") { return this->HandleVersionMode(args); } + if (args[0] == "GET_WARNING") { + return this->HandleGetWarningMode(args); + } std::ostringstream e; e << "given unknown first argument \"" << args[0] << "\""; @@ -143,7 +146,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args) << "The call to cmake_policy(GET " << id << " ...) at which this " << "error appears requests the policy, and this version of CMake " << "requires that the policy be set to NEW before it is checked."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); } } @@ -181,3 +184,33 @@ bool cmCMakePolicyCommand::HandleVersionMode( this->Makefile->SetPolicyVersion(version_min, version_max); return true; } + +bool cmCMakePolicyCommand::HandleGetWarningMode( + std::vector<std::string> const& args) +{ + if (args.size() != 3) { + this->SetError( + "GET_WARNING must be given exactly 2 additional arguments."); + return false; + } + + // Get arguments. + std::string const& id = args[1]; + std::string const& var = args[2]; + + // Lookup the policy number. + cmPolicies::PolicyID pid; + if (!cmPolicies::GetPolicyID(id.c_str(), pid)) { + std::ostringstream e; + e << "GET_WARNING given policy \"" << id + << "\" which is not known to this version of CMake."; + this->SetError(e.str()); + return false; + } + + // Lookup the policy warning. + this->Makefile->AddDefinition(var, + cmPolicies::GetPolicyWarning(pid).c_str()); + + return true; +} |