mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-25 01:28:50 -05:00
Merge topic 'try_compile-no-try_run-args'
b976b844d2try_compile: Don't accept try_run arguments24c83bb35btry_compile: Fix quotes in reporting of unknown arguments Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7585
This commit is contained in:
@@ -145,6 +145,10 @@ auto const TryCompileArgParser =
|
||||
.BIND_LANG_PROPS(HIP)
|
||||
.BIND_LANG_PROPS(OBJC)
|
||||
.BIND_LANG_PROPS(OBJCXX)
|
||||
/* keep semicolon on own line */;
|
||||
|
||||
auto const TryRunArgParser =
|
||||
cmArgumentParser<Arguments>{ TryCompileArgParser }
|
||||
.Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable)
|
||||
.Bind("RUN_OUTPUT_VARIABLE"_s, &Arguments::RunOutputVariable)
|
||||
.Bind("RUN_OUTPUT_STDOUT_VARIABLE"_s, &Arguments::RunOutputStdOutVariable)
|
||||
@@ -160,12 +164,13 @@ Arguments cmCoreTryCompile::ParseArgs(
|
||||
cmRange<std::vector<std::string>::const_iterator> args, bool isTryRun)
|
||||
{
|
||||
std::vector<std::string> unparsedArguments;
|
||||
auto arguments = TryCompileArgParser.Parse(args, &unparsedArguments, 0);
|
||||
const auto& parser = (isTryRun ? TryRunArgParser : TryCompileArgParser);
|
||||
auto arguments = parser.Parse(args, &unparsedArguments, 0);
|
||||
if (!arguments.MaybeReportError(*(this->Makefile)) &&
|
||||
!unparsedArguments.empty()) {
|
||||
std::string m = "Unknown arguments:";
|
||||
for (const auto& i : unparsedArguments) {
|
||||
m = cmStrCat(m, "\n ", i, "\"");
|
||||
m = cmStrCat(m, "\n \"", i, "\"");
|
||||
}
|
||||
this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m);
|
||||
}
|
||||
@@ -194,31 +199,6 @@ Arguments cmCoreTryCompile::ParseArgs(
|
||||
arguments.RunWorkingDirectory->empty()) {
|
||||
arguments.RunWorkingDirectory = cm::nullopt;
|
||||
}
|
||||
} else {
|
||||
std::string tryRunArgs;
|
||||
if (arguments.CompileOutputVariable) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " COMPILE_OUTPUT_VARIABLE\n");
|
||||
}
|
||||
if (arguments.RunOutputVariable) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " RUN_OUTPUT_VARIABLE\n");
|
||||
}
|
||||
if (arguments.RunOutputStdOutVariable) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " RUN_OUTPUT_STDOUT_VARIABLE\n");
|
||||
}
|
||||
if (arguments.RunOutputStdErrVariable) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " RUN_OUTPUT_STDERR_VARIABLE\n");
|
||||
}
|
||||
if (arguments.RunWorkingDirectory) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " WORKING_DIRECTORY\n");
|
||||
}
|
||||
if (arguments.RunArgs) {
|
||||
tryRunArgs = cmStrCat(tryRunArgs, " ARGS\n");
|
||||
}
|
||||
if (!tryRunArgs.empty()) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::AUTHOR_WARNING,
|
||||
cmStrCat("Ignoring try_run arguments for try_compile:\n", tryRunArgs));
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
^CMake Warning \(dev\) at TryRunArgs.cmake:[0-9]+ \(try_compile\):
|
||||
Ignoring try_run arguments for try_compile:
|
||||
|
||||
COMPILE_OUTPUT_VARIABLE
|
||||
RUN_OUTPUT_VARIABLE
|
||||
RUN_OUTPUT_STDOUT_VARIABLE
|
||||
RUN_OUTPUT_STDERR_VARIABLE
|
||||
WORKING_DIRECTORY
|
||||
ARGS
|
||||
Unknown arguments:
|
||||
|
||||
"COMPILE_OUTPUT_VARIABLE"
|
||||
"compOutputVar"
|
||||
"RUN_OUTPUT_VARIABLE"
|
||||
"runOutputVar"
|
||||
"RUN_OUTPUT_STDOUT_VARIABLE"
|
||||
"runOutputStdOutVar"
|
||||
"RUN_OUTPUT_STDERR_VARIABLE"
|
||||
"runOutputStdErrVar"
|
||||
"WORKING_DIRECTORY"
|
||||
"runWorkDir"
|
||||
"ARGS"
|
||||
"runArgs"
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
||||
|
||||
Reference in New Issue
Block a user