diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-11-23 22:02:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-12-16 15:12:25 (GMT) |
commit | 048a02d5bb842c783fad03105bb60e44227765ad (patch) | |
tree | 3f88daaeb5e6c4fa6c13a3d067f5e472f04ebba5 /Source/cmCoreTryCompile.cxx | |
parent | 746c776caf1207049922edb3ea63586b94fca4c6 (diff) | |
download | CMake-048a02d5bb842c783fad03105bb60e44227765ad.zip CMake-048a02d5bb842c783fad03105bb60e44227765ad.tar.gz CMake-048a02d5bb842c783fad03105bb60e44227765ad.tar.bz2 |
ConfigureLog: Log try_compile and try_run checks
Add configure log events for `try_compile` and `try_run` results.
Issue: #23200
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e7351b2..25a0e2d 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -16,6 +16,7 @@ #include "cmsys/FStream.hxx" #include "cmArgumentParser.h" +#include "cmConfigureLog.h" #include "cmExportTryCompileFileGenerator.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" @@ -1124,6 +1125,11 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( } cmTryCompileResult result; + result.SourceDirectory = sourceDirectory; + result.BinaryDirectory = this->BinaryDirectory; + result.Variable = *arguments.CompileResultVariable; + result.VariableCached = !arguments.NoCache; + result.Output = std::move(output); result.ExitCode = res; return result; } @@ -1266,3 +1272,20 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, file.close(); return filepath; } + +void cmCoreTryCompile::WriteTryCompileEventFields( + cmConfigureLog& log, cmTryCompileResult const& compileResult) +{ +#ifndef CMAKE_BOOTSTRAP + log.BeginObject("directories"_s); + log.WriteValue("source"_s, compileResult.SourceDirectory); + log.WriteValue("binary"_s, compileResult.BinaryDirectory); + log.EndObject(); + log.BeginObject("buildResult"_s); + log.WriteValue("variable"_s, compileResult.Variable); + log.WriteValue("cached"_s, compileResult.VariableCached); + log.WriteLiteralTextBlock("stdout"_s, compileResult.Output); + log.WriteValue("exitCode"_s, compileResult.ExitCode); + log.EndObject(); +#endif +} |