From 6646771b0f4f6ec71a5717a68f74c987eb399b4e Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 24 Jul 2018 13:10:14 -0400 Subject: project: Do not issue CMP0048 warnings on injected call Fixes: #18202 --- Source/cmProjectCommand.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Source/cmProjectCommand.cxx') diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index a25bd6b381..ee440079f4 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -69,6 +69,7 @@ bool cmProjectCommand::InitialPass(std::vector 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 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 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, ""); } -- cgit v1.2.1