mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 18:51:05 -05:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user