diff options
author | Brad King <brad.king@kitware.com> | 2018-10-11 11:41:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-10-11 11:41:06 (GMT) |
commit | b7cba6ba00e9ae11d86fbb7fbf69eedff9e1c8c2 (patch) | |
tree | 76c2f9b08812723ef99ab0ef5a8d6d281cba19c8 /Source | |
parent | 7d2ee4cb98b85946cc6b9befd33f20fab10e55bf (diff) | |
parent | 0d988f98e531333b32d0f1628acf86f8baa22241 (diff) | |
download | CMake-b7cba6ba00e9ae11d86fbb7fbf69eedff9e1c8c2.zip CMake-b7cba6ba00e9ae11d86fbb7fbf69eedff9e1c8c2.tar.gz CMake-b7cba6ba00e9ae11d86fbb7fbf69eedff9e1c8c2.tar.bz2 |
Merge topic 'cmake_policy-get_warning'
0d988f98e5 cmake_policy: Add undocumented GET_WARNING command
f9f96598df Help: Convert FindOpenGL documentation to block comment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2472
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCMakePolicyCommand.cxx | 33 | ||||
-rw-r--r-- | Source/cmCMakePolicyCommand.h | 1 | ||||
-rw-r--r-- | Source/cmPolicies.h | 2 |
3 files changed, 35 insertions, 1 deletions
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index adf9ef8..3209ea5 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -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] << "\""; @@ -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; +} diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index b18576c..cca1406 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -37,6 +37,7 @@ private: bool HandleSetMode(std::vector<std::string> const& args); bool HandleGetMode(std::vector<std::string> const& args); bool HandleVersionMode(std::vector<std::string> const& args); + bool HandleGetWarningMode(std::vector<std::string> const& args); }; #endif diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a469f1e..5c27124 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -236,7 +236,7 @@ class cmMakefile; "target_link_libraries allows use with targets in other directories.", 3, \ 13, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0080, \ - "BundleUtilities cannot be included at configure time", 3, 13, 0, \ + "BundleUtilities cannot be included at configure time.", 3, 13, 0, \ cmPolicies::WARN) \ SELECT(POLICY, CMP0081, \ "Relative paths not allowed in LINK_DIRECTORIES target property.", \ |