summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCTest.cxx20
-rw-r--r--Source/cmConfigureLog.cxx16
-rw-r--r--Source/cmConfigureLog.h1
-rw-r--r--Source/cmCoreTryCompile.cxx44
-rw-r--r--Source/cmCoreTryCompile.h4
-rw-r--r--Source/cmTryCompileCommand.cxx8
-rw-r--r--Source/cmTryRunCommand.cxx3
-rw-r--r--Source/cmake.h13
9 files changed, 89 insertions, 22 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f06da4d..5a7e54b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 25)
-set(CMake_VERSION_PATCH 20230115)
+set(CMake_VERSION_PATCH 20230118)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index b00fa73..72cd8cd 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -217,6 +217,7 @@ struct cmCTest::Private
std::map<std::string, std::string> Definitions;
cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy;
+ bool NoTestsModeSetInCli = false;
};
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
@@ -2132,6 +2133,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
} else {
this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
}
+ this->Impl->NoTestsModeSetInCli = true;
}
// options that control what tests are run
@@ -2774,6 +2776,24 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
}
}
+ // handle CTEST_NO_TESTS_ACTION environment variable
+ if (!this->Impl->NoTestsModeSetInCli) {
+ std::string action;
+ if (cmSystemTools::GetEnv("CTEST_NO_TESTS_ACTION", action) &&
+ !action.empty()) {
+ if (action == "error"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Error;
+ } else if (action == "ignore"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
+ } else {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Unknown value for CTEST_NO_TESTS_ACTION: '" << action
+ << '\'');
+ return 1;
+ }
+ }
+ }
+
// TestProgressOutput only supported if console supports it and not logging
// to a file
this->Impl->TestProgressOutput = this->Impl->TestProgressOutput &&
diff --git a/Source/cmConfigureLog.cxx b/Source/cmConfigureLog.cxx
index c2a5b5e..1b00b4f 100644
--- a/Source/cmConfigureLog.cxx
+++ b/Source/cmConfigureLog.cxx
@@ -17,6 +17,7 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -78,6 +79,21 @@ void cmConfigureLog::WriteBacktrace(cmMakefile const& mf)
this->WriteValue("backtrace"_s, backtrace);
}
+void cmConfigureLog::WriteChecks(cmMakefile const& mf)
+{
+ if (!mf.GetCMakeInstance()->HasCheckInProgress()) {
+ return;
+ }
+ this->BeginObject("checks"_s);
+ for (auto const& value :
+ cmReverseRange(mf.GetCMakeInstance()->GetCheckInProgressMessages())) {
+ this->BeginLine() << "- ";
+ this->Encoder->write(value, &this->Stream);
+ this->EndLine();
+ }
+ this->EndObject();
+}
+
void cmConfigureLog::EnsureInit()
{
if (this->Opened) {
diff --git a/Source/cmConfigureLog.h b/Source/cmConfigureLog.h
index 9caac66..d672445 100644
--- a/Source/cmConfigureLog.h
+++ b/Source/cmConfigureLog.h
@@ -29,6 +29,7 @@ public:
bool IsAnyLogVersionEnabled(std::vector<unsigned long> const& v) const;
void WriteBacktrace(cmMakefile const& mf);
+ void WriteChecks(cmMakefile const& mf);
void EnsureInit();
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 2a4ea80..2084b33 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -151,7 +151,9 @@ 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("NO_LOG"_s, &Arguments::NoLog)
.Bind("CMAKE_FLAGS"_s, &Arguments::CMakeFlags)
.Bind("__CMAKE_INTERNAL"_s, &Arguments::CMakeInternal)
/* keep semicolon on own line */;
@@ -1099,23 +1101,35 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if ((res == 0) && arguments.CopyFileTo) {
std::string const& copyFile = *arguments.CopyFileTo;
- if (this->OutputFile.empty() ||
- !cmSystemTools::CopyFileAlways(this->OutputFile, copyFile)) {
- std::ostringstream emsg;
+ cmsys::SystemTools::CopyStatus status =
+ cmSystemTools::CopyFileAlways(this->OutputFile, copyFile);
+ if (!status) {
+ std::string err = status.GetString();
+ switch (status.Path) {
+ case cmsys::SystemTools::CopyStatus::SourcePath:
+ err = cmStrCat(err, " (input)");
+ break;
+ case cmsys::SystemTools::CopyStatus::DestPath:
+ err = cmStrCat(err, " (output)");
+ break;
+ default:
+ break;
+ }
/* clang-format off */
- emsg << "Cannot copy output executable\n"
- << " '" << this->OutputFile << "'\n"
- << "to destination specified by COPY_FILE:\n"
- << " '" << copyFile << "'\n";
+ err = cmStrCat(
+ "Cannot copy output executable\n",
+ " '", this->OutputFile, "'\n",
+ "to destination specified by COPY_FILE:\n",
+ " '", copyFile, "'\n",
+ "because:\n",
+ " ", err, "\n",
+ this->FindErrorMessage);
/* clang-format on */
- if (!this->FindErrorMessage.empty()) {
- emsg << this->FindErrorMessage;
- }
if (!arguments.CopyFileError) {
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, emsg.str());
+ this->Makefile->IssueMessage(MessageType::FATAL_ERROR, err);
return cm::nullopt;
}
- copyFileErrorMessage = emsg.str();
+ copyFileErrorMessage = std::move(err);
}
}
@@ -1126,6 +1140,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;
@@ -1278,6 +1295,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);
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index 6d29586..1ec4405 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -21,6 +21,8 @@ class cmRange;
struct cmTryCompileResult
{
+ cm::optional<std::string> LogDescription;
+
std::string SourceDirectory;
std::string BinaryDirectory;
@@ -71,7 +73,9 @@ public:
cm::optional<std::string> OutputVariable;
cm::optional<std::string> CopyFileTo;
cm::optional<std::string> CopyFileError;
+ cm::optional<ArgumentParser::NonEmpty<std::string>> LogDescription;
bool NoCache = false;
+ bool NoLog = false;
// Argument for try_run only.
// Keep in sync with warnings in cmCoreTryCompile::ParseArgs.
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index c70c03e..789ffe9 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -27,6 +27,7 @@ void WriteTryCompileEvent(cmConfigureLog& log, cmMakefile const& mf,
if (log.IsAnyLogVersionEnabled(LogVersionsWithTryCompileV1)) {
log.BeginEvent("try_compile-v1");
log.WriteBacktrace(mf);
+ log.WriteChecks(mf);
cmCoreTryCompile::WriteTryCompileEventFields(log, compileResult);
log.EndEvent();
}
@@ -81,14 +82,15 @@ bool cmTryCompileCommand(std::vector<std::string> const& args,
return true;
}
- if (cm::optional<cmTryCompileResult> compileResult =
- tc.TryCompileCode(arguments, targetType)) {
+ cm::optional<cmTryCompileResult> compileResult =
+ tc.TryCompileCode(arguments, targetType);
#ifndef CMAKE_BOOTSTRAP
+ if (compileResult && !arguments.NoLog) {
if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) {
WriteTryCompileEvent(*log, mf, *compileResult);
}
-#endif
}
+#endif
// if They specified clean then we clean up what we can
if (tc.SrcFileSignature) {
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index ef59c32..21bd95a 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -46,6 +46,7 @@ void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf,
if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) {
log.BeginEvent("try_run-v1");
log.WriteBacktrace(mf);
+ log.WriteChecks(mf);
cmCoreTryCompile::WriteTryCompileEventFields(log, compileResult);
log.BeginObject("runResult"_s);
@@ -246,7 +247,7 @@ bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv)
}
#ifndef CMAKE_BOOTSTRAP
- if (compileResult) {
+ if (compileResult && !arguments.NoLog) {
cmMakefile const& mf = *(this->Makefile);
if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) {
WriteTryRunEvent(*log, mf, *compileResult, runResult);
diff --git a/Source/cmake.h b/Source/cmake.h
index 10db87d..d1f388a 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -9,7 +9,6 @@
#include <map>
#include <memory>
#include <set>
-#include <stack>
#include <string>
#include <unordered_set>
#include <utility>
@@ -472,13 +471,17 @@ public:
}
std::string GetTopCheckInProgressMessage()
{
- auto message = this->CheckInProgressMessages.top();
- this->CheckInProgressMessages.pop();
+ auto message = this->CheckInProgressMessages.back();
+ this->CheckInProgressMessages.pop_back();
return message;
}
void PushCheckInProgressMessage(std::string message)
{
- this->CheckInProgressMessages.emplace(std::move(message));
+ this->CheckInProgressMessages.emplace_back(std::move(message));
+ }
+ std::vector<std::string> const& GetCheckInProgressMessages() const
+ {
+ return this->CheckInProgressMessages;
}
//! Should `message` command display context.
@@ -773,7 +776,7 @@ private:
bool LogLevelWasSetViaCLI = false;
bool LogContext = false;
- std::stack<std::string> CheckInProgressMessages;
+ std::vector<std::string> CheckInProgressMessages;
std::unique_ptr<cmGlobalGenerator> GlobalGenerator;