summaryrefslogtreecommitdiffstats
path: root/Source/cmProjectCommand.cxx
diff options
context:
space:
mode:
authorfriendlyanon <friendlyanon_@hotmail.com>2022-11-11 15:15:30 (GMT)
committerfriendlyanon <friendlyanon_@hotmail.com>2022-11-11 21:49:36 (GMT)
commit59573bf5b9afb2157c73b18dd189a0927dafee52 (patch)
treea51943c3be8f4430a314560e5afba145013b28a3 /Source/cmProjectCommand.cxx
parent23f3dd9f7c87bbf02685f388cb3913a8878e4f3b (diff)
downloadCMake-59573bf5b9afb2157c73b18dd189a0927dafee52.zip
CMake-59573bf5b9afb2157c73b18dd189a0927dafee52.tar.gz
CMake-59573bf5b9afb2157c73b18dd189a0927dafee52.tar.bz2
project: Warn at top-level if `cmake_minimum_required` wasn't called
The top-level project() call will now issue an AUTHOR_WARNING if it wasn't called after cmake_minimum_required(). Fixes: #24071
Diffstat (limited to 'Source/cmProjectCommand.cxx')
-rw-r--r--Source/cmProjectCommand.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 249fe2d..4d1ccfe 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -34,6 +34,15 @@ bool cmProjectCommand(std::vector<std::string> const& args,
}
cmMakefile& mf = status.GetMakefile();
+ if (mf.IsRootMakefile() &&
+ !mf.GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) {
+ mf.IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ "cmake_minimum_required() should be called prior to this top-level "
+ "project() call. Please see the cmake-commands(7) manual for usage "
+ "documentation of both commands.");
+ }
+
if (!IncludeByVariable(status, "CMAKE_PROJECT_INCLUDE_BEFORE")) {
return false;
}