Merge topic 'improve-try_compile-arg-error'

f976800577 try_compile: More useful error if insufficient arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7682
This commit is contained in:
Brad King
2022-09-19 14:16:51 +00:00
committed by Kitware Robot
5 changed files with 12 additions and 7 deletions
+5 -2
View File
@@ -16,12 +16,15 @@
bool cmTryCompileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
cmMakefile& mf = status.GetMakefile();
if (args.size() < 3) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
"The try_compile() command requires at least 3 arguments.");
return false;
}
cmMakefile& mf = status.GetMakefile();
if (mf.GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
+4 -2
View File
@@ -469,12 +469,14 @@ void TryRunCommandImpl::DoNotRunExecutable(
bool cmTryRunCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
cmMakefile& mf = status.GetMakefile();
if (args.size() < 4) {
mf.IssueMessage(MessageType::FATAL_ERROR,
"The try_run() command requires at least 4 arguments.");
return false;
}
cmMakefile& mf = status.GetMakefile();
if (mf.GetCMakeInstance()->GetWorkingMode() == cmake::FIND_PACKAGE_MODE) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
+1 -1
View File
@@ -1,4 +1,4 @@
CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+1 -1
View File
@@ -1,4 +1,4 @@
CMake Error at OneArg.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
@@ -1,4 +1,4 @@
CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
The try_compile\(\) command requires at least 3 arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)