summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-12 18:55:57 (GMT)
committerBrad King <brad.king@kitware.com>2023-01-12 18:55:57 (GMT)
commit5cd5c8cac5460f37dbdc27ad48cabc3282f2f5f8 (patch)
tree03097321152d1b2b60eb80c0c8c12c1471fbb614 /Source
parent0191e8b512d4a2d2bdb9f65ea9edebced9dee372 (diff)
parent2f85ec0a37d1ad75956dd81016a8c7ab90ff845b (diff)
downloadCMake-5cd5c8cac5460f37dbdc27ad48cabc3282f2f5f8.zip
CMake-5cd5c8cac5460f37dbdc27ad48cabc3282f2f5f8.tar.gz
CMake-5cd5c8cac5460f37dbdc27ad48cabc3282f2f5f8.tar.bz2
Merge branch 'backport-try_run-cross-compile' into try_run-cross-compile
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTryRunCommand.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index dcb52da..ef59c32 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -86,7 +86,7 @@ public:
std::string* runOutputStdOutContents,
std::string* runOutputStdErrContents);
void DoNotRunExecutable(const std::string& runArgs,
- const std::string& srcFile,
+ cm::optional<std::string> const& srcFile,
std::string const& compileResultVariable,
std::string* runOutputContents,
std::string* runOutputStdOutContents,
@@ -191,7 +191,7 @@ bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv)
bool const stdOutErrRequired = (arguments.RunOutputStdOutVariable ||
arguments.RunOutputStdErrVariable);
this->DoNotRunExecutable(
- runArgs, *arguments.SourceDirectoryOrFile,
+ runArgs, arguments.SourceDirectoryOrFile,
*arguments.CompileResultVariable,
captureRunOutput ? &runOutputContents : nullptr,
captureRunOutputStdOutErr ? &runOutputStdOutContents : nullptr,
@@ -315,7 +315,7 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs,
the executable would have produced.
*/
void TryRunCommandImpl::DoNotRunExecutable(
- const std::string& runArgs, const std::string& srcFile,
+ const std::string& runArgs, cm::optional<std::string> const& srcFile,
std::string const& compileResultVariable, std::string* out,
std::string* stdOut, std::string* stdErr, bool stdOutErrRequired)
{
@@ -498,9 +498,11 @@ void TryRunCommandImpl::DoNotRunExecutable(
comment += "The ";
comment += compileResultVariable;
- comment += " variable holds the build result for this try_run().\n\n"
- "Source file : ";
- comment += srcFile + "\n";
+ comment += " variable holds the build result for this try_run().\n\n";
+ if (srcFile) {
+ comment += "Source file : ";
+ comment += *srcFile + "\n";
+ }
comment += "Executable : ";
comment += copyDest + "\n";
comment += "Run arguments : ";