summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-13 16:19:29 (GMT)
committerBrad King <brad.king@kitware.com>2023-01-16 21:58:50 (GMT)
commit9d9e8450a872a4a9ec1a74cc7a73df100c32c7e8 (patch)
tree0ccb5c395ecf839e8d3d8252a4df0ddd563221cc /Source/cmCoreTryCompile.cxx
parent65ed5c2ca816f8ba4068b163a2dcdab079df0038 (diff)
downloadCMake-9d9e8450a872a4a9ec1a74cc7a73df100c32c7e8.zip
CMake-9d9e8450a872a4a9ec1a74cc7a73df100c32c7e8.tar.gz
CMake-9d9e8450a872a4a9ec1a74cc7a73df100c32c7e8.tar.bz2
try_compile: Add optional LOG_DESCRIPTION to record in configure log
Issue: #23200
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 1883816..29f6a98 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -151,6 +151,7 @@ cmArgumentParser<Arguments> makeTryRunParser(
auto const TryCompileBaseArgParser =
cmArgumentParser<Arguments>{}
.Bind(0, &Arguments::CompileResultVariable)
+ .Bind("LOG_DESCRIPTION"_s, &Arguments::LogDescription)
.Bind("NO_CACHE"_s, &Arguments::NoCache)
.Bind("CMAKE_FLAGS"_s, &Arguments::CMakeFlags)
.Bind("__CMAKE_INTERNAL"_s, &Arguments::CMakeInternal)
@@ -1138,6 +1139,9 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
}
cmTryCompileResult result;
+ if (arguments.LogDescription) {
+ result.LogDescription = *arguments.LogDescription;
+ }
result.SourceDirectory = sourceDirectory;
result.BinaryDirectory = this->BinaryDirectory;
result.Variable = *arguments.CompileResultVariable;
@@ -1290,6 +1294,9 @@ void cmCoreTryCompile::WriteTryCompileEventFields(
cmConfigureLog& log, cmTryCompileResult const& compileResult)
{
#ifndef CMAKE_BOOTSTRAP
+ if (compileResult.LogDescription) {
+ log.WriteValue("description"_s, *compileResult.LogDescription);
+ }
log.BeginObject("directories"_s);
log.WriteValue("source"_s, compileResult.SourceDirectory);
log.WriteValue("binary"_s, compileResult.BinaryDirectory);