diff options
author | Brad King <brad.king@kitware.com> | 2023-01-30 21:09:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-02-01 14:32:42 (GMT) |
commit | 5252c885693ce35467f6c4c7fdc8deb6406df149 (patch) | |
tree | 35704c91a461029b32411307789d096df0a52a10 /Source/cmConfigureLog.cxx | |
parent | 0a48d8fe5ccf8a44bcada7b528f4cf4dd591b18e (diff) | |
download | CMake-5252c885693ce35467f6c4c7fdc8deb6406df149.zip CMake-5252c885693ce35467f6c4c7fdc8deb6406df149.tar.gz CMake-5252c885693ce35467f6c4c7fdc8deb6406df149.tar.bz2 |
try_compile: Record propagated CMake variables in configure log
These provide more detailed information about how the test project was
configured.
Issue: #23200
Diffstat (limited to 'Source/cmConfigureLog.cxx')
-rw-r--r-- | Source/cmConfigureLog.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmConfigureLog.cxx b/Source/cmConfigureLog.cxx index 1cf785a..a6658e2 100644 --- a/Source/cmConfigureLog.cxx +++ b/Source/cmConfigureLog.cxx @@ -193,6 +193,30 @@ void cmConfigureLog::WriteValue(cm::string_view key, this->EndObject(); } +void cmConfigureLog::WriteValue(cm::string_view key, + std::map<std::string, std::string> const& map) +{ + static const std::string rawKeyChars = // + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // + "abcdefghijklmnopqrstuvwxyz" // + "0123456789" // + "-_" // + ; + this->BeginObject(key); + for (auto const& entry : map) { + if (entry.first.find_first_not_of(rawKeyChars) == std::string::npos) { + this->WriteValue(entry.first, entry.second); + } else { + this->BeginLine(); + this->Encoder->write(entry.first, &this->Stream); + this->Stream << ": "; + this->Encoder->write(entry.second, &this->Stream); + this->EndLine(); + } + } + this->EndObject(); +} + void cmConfigureLog::WriteLiteralTextBlock(cm::string_view key, cm::string_view text) { |