try_compile: More useful error if insufficient arguments
Tweak try_compile and try_run to give a more informative error (rather than "unknown error") when given an insufficient number of arguments.
This commit is contained in:
parent
01a25d72c6
commit
f976800577
@ -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,
|
||||
|
@ -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,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,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\)
|
||||
|
Loading…
Reference in New Issue
Block a user