diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-07-25 12:14:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-07-25 12:15:02 (GMT) |
commit | ae2b12a95c346d710459657c3cce967bd590f678 (patch) | |
tree | 3de1c84bc081b56611e575181372c2170d9aac53 /Source | |
parent | 873f40ecec50fbe6c8e98a0764c02a423dbfa05b (diff) | |
parent | 6646771b0f4f6ec71a5717a68f74c987eb399b4e (diff) | |
download | CMake-ae2b12a95c346d710459657c3cce967bd590f678.zip CMake-ae2b12a95c346d710459657c3cce967bd590f678.tar.gz CMake-ae2b12a95c346d710459657c3cce967bd590f678.tar.bz2 |
Merge topic 'project-injected-no-cmp0048'
6646771b0f project: Do not issue CMP0048 warnings on injected call
08eb157c03 Tests: Add case showing CMP0048 warning on injected project command
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2235
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmProjectCommand.cxx | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a9b0b78..c868159 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1526,6 +1526,8 @@ void cmMakefile::Configure() project.Name.Lower = "project"; project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted, 0); + project.Arguments.emplace_back("__CMAKE_INJECTED_PROJECT_COMMAND__", + cmListFileArgument::Unquoted, 0); listFile.Functions.insert(listFile.Functions.begin(), project); } } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index a25bd6b..ee44007 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -69,6 +69,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, bool haveLanguages = false; bool haveDescription = false; bool haveHomepage = false; + bool injectedProjectCommand = false; std::string version; std::string description; std::string homepage; @@ -160,6 +161,8 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, "by a value that expanded to nothing."); resetReporter(); }; + } else if (i == 1 && args[i] == "__CMAKE_INJECTED_PROJECT_COMMAND__") { + injectedProjectCommand = true; } else if (doing == DoingVersion) { doing = DoingLanguages; version = args[i]; @@ -280,8 +283,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, const char* v = this->Makefile->GetDefinition(i); if (v && *v) { if (cmp0048 == cmPolicies::WARN) { - vw += "\n "; - vw += i; + if (!injectedProjectCommand) { + vw += "\n "; + vw += i; + } } else { this->Makefile->AddDefinition(i, ""); } |