summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-17 14:26:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-01-17 14:26:50 (GMT)
commit45f86b9990e3ac7e9ec5909253275dbf2728bccc (patch)
treed6efcff17db9cd192d0b38442a0e7e0f5bb9d358
parentdd18be5ebf6486486a272f47df3318d1db3a03cc (diff)
parent48292c8624b901a842b6d4f8a88ca00f898e5639 (diff)
downloadCMake-45f86b9990e3ac7e9ec5909253275dbf2728bccc.zip
CMake-45f86b9990e3ac7e9ec5909253275dbf2728bccc.tar.gz
CMake-45f86b9990e3ac7e9ec5909253275dbf2728bccc.tar.bz2
Merge topic 'configure-log'
48292c8624 try_compile: Record stack of in-progess checks in configure log d4bf7d80c6 try_compile: Add a NO_LOG option to skip recording in the configure log 9d9e8450a8 try_compile: Add optional LOG_DESCRIPTION to record in configure log 65ed5c2ca8 try_compile: Report underlying error when COPY_FILE fails 0418efb7ad Tests: Add explicit ConfigureLog case to RunCMake.try_compile 189557bd74 cmake: Make entire in-progress check stack available internally 96ce3581ab Help: Clarify backtrace order in cmake-configure-log(7) Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8072
-rw-r--r--Help/command/try_compile.rst19
-rw-r--r--Help/command/try_run.rst4
-rw-r--r--Help/manual/cmake-configure-log.7.rst24
-rw-r--r--Help/release/dev/configure-log.rst8
-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
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-bad.c1
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-config.txt52
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-stdout.txt4
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-test.c4
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog.cmake25
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt8
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs.cmake3
-rw-r--r--Tests/RunCMake/try_compile/Inspect-config.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription.cmake4
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake1
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog-config.txt9
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog-stdout.txt4
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog.cmake16
27 files changed, 265 insertions, 23 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 52c0ae8..8f6a4eb 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -18,7 +18,9 @@ Try Compiling Whole Projects
SOURCE_DIR <srcdir>
[BINARY_DIR <bindir>]
[TARGET <targetName>]
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
@@ -47,7 +49,9 @@ which was present in older versions of CMake:
try_compile(<resultVar> <bindir> <srcdir>
<projectName> [<targetName>]
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
@@ -63,7 +67,9 @@ Try Compiling Source Files
SOURCE_FROM_CONTENT <name> <content> |
SOURCE_FROM_VAR <name> <var> |
SOURCE_FROM_FILE <name> <path> >...
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -115,7 +121,9 @@ which was present in older versions of CMake:
.. code-block:: cmake
try_compile(<resultVar> <bindir> <srcfile|SOURCES srcfile...>
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -171,6 +179,12 @@ The options are:
set the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated
project, depending on the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable.
+``LOG_DESCRIPTION <text>``
+ .. versionadded:: 3.26
+
+ Specify a non-empty text description of the purpose of the check.
+ This is recorded in the :manual:`cmake-configure-log(7)` entry.
+
``NO_CACHE``
.. versionadded:: 3.25
@@ -191,6 +205,11 @@ The options are:
the test is part of a larger inspection), ``NO_CACHE`` may be useful to avoid
leaking the intermediate result variable into the cache.
+``NO_LOG``
+ .. versionadded:: 3.26
+
+ Do not record a :manual:`cmake-configure-log(7)` entry for this call.
+
``OUTPUT_VARIABLE <var>``
Store the output from the build process in the given variable.
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index cd41a4b..ef8ec96 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -17,7 +17,9 @@ Try Compiling and Running Source Files
SOURCE_FROM_CONTENT <name> <content> |
SOURCE_FROM_VAR <name> <var> |
SOURCE_FROM_FILE <name> <path> >...
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -55,7 +57,9 @@ which was present in older versions of CMake:
try_run(<runResultVar> <compileResultVar>
<bindir> <srcfile|SOURCES srcfile...>
+ [LOG_DESCRIPTION <text>]
[NO_CACHE]
+ [NO_LOG]
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
diff --git a/Help/manual/cmake-configure-log.7.rst b/Help/manual/cmake-configure-log.7.rst
index f909717..2620124 100644
--- a/Help/manual/cmake-configure-log.7.rst
+++ b/Help/manual/cmake-configure-log.7.rst
@@ -106,6 +106,8 @@ Every event kind is represented by a YAML mapping of the form:
kind: "<kind>-v<major>"
backtrace:
- "<file>:<line> (<function>)"
+ checks:
+ - "Checking for something"
#...event-specific keys...
The keys common to all events are:
@@ -115,8 +117,16 @@ The keys common to all events are:
``backtrace``
A YAML block sequence reporting the call stack of CMake source
- locations at which the event occurred. Each node is a string
- specifying one location formatted as ``<file>:<line> (<function>)``.
+ locations at which the event occurred, from most-recent to
+ least-recent. Each node is a string specifying one location
+ formatted as ``<file>:<line> (<function>)``.
+
+``checks``
+ An optional key that is present when the event occurred with
+ at least one pending :command:`message(CHECK_START)`. Its value
+ is a YAML block sequence reporting the stack of pending checks,
+ from most-recent to least-recent. Each node is a string containing
+ a pending check message.
Additional mapping keys are specific to each (versioned) event kind,
described below.
@@ -140,6 +150,9 @@ A ``try_compile-v1`` event is a YAML mapping:
kind: "try_compile-v1"
backtrace:
- "CMakeLists.txt:123 (try_compile)"
+ checks:
+ - "Checking for something"
+ description: "Explicit LOG_DESCRIPTION"
directories:
source: "/path/to/.../TryCompile-01234"
binary: "/path/to/.../TryCompile-01234"
@@ -152,6 +165,10 @@ A ``try_compile-v1`` event is a YAML mapping:
The keys specific to ``try_compile-v1`` mappings are:
+``description``
+ An optional key that is present when the ``LOG_DESCRIPTION <text>`` option
+ was used. Its value is a string containing the description ``<text>``.
+
``directories``
A mapping describing the directories associated with the
compilation attempt. It has the following keys:
@@ -206,6 +223,9 @@ A ``try_run-v1`` event is a YAML mapping:
kind: "try_run-v1"
backtrace:
- "CMakeLists.txt:456 (try_run)"
+ checks:
+ - "Checking for something"
+ description: "Explicit LOG_DESCRIPTION"
directories:
source: "/path/to/.../TryCompile-56789"
binary: "/path/to/.../TryCompile-56789"
diff --git a/Help/release/dev/configure-log.rst b/Help/release/dev/configure-log.rst
index 34b8fb3..f802a8c 100644
--- a/Help/release/dev/configure-log.rst
+++ b/Help/release/dev/configure-log.rst
@@ -6,3 +6,11 @@ Configure Log
* The :manual:`cmake-file-api(7)` gained a new "configureLog" object kind
that enables stable access to the :manual:`cmake-configure-log(7)`.
+
+* The :command:`try_compile` and :command:`try_run` commands gained
+ a ``LOG_DESCRIPTION`` option specifying text to be recorded in the
+ :manual:`cmake-configure-log(7)`.
+
+* The :command:`try_compile` and :command:`try_run` commands gained a
+ ``NO_LOG`` option to skip recording a :manual:`cmake-configure-log(7)`
+ entry.
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;
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-bad.c b/Tests/RunCMake/try_compile/ConfigureLog-bad.c
new file mode 100644
index 0000000..6508ead
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-bad.c
@@ -0,0 +1 @@
+#error "This does not compile!"
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-config.txt b/Tests/RunCMake/try_compile/ConfigureLog-config.txt
new file mode 100644
index 0000000..262ed3c
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-config.txt
@@ -0,0 +1,52 @@
+^
+---
+events:
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)"
+ - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
+ - "ConfigureLog.cmake:[0-9]+ \(enable_language\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting C compiler ABI info"
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "CMAKE_C_ABI_COMPILED"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "ConfigureLog.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Source that should not compile\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "COMPILE_RESULT"
+ cached: true
+ stdout: \|.*
+ exitCode: [1-9][0-9]*
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "ConfigureLog.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 2"
+ - "Check 1"
+ description: "Source that should compile\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "COMPILE_RESULT"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+\.\.\.$
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt
new file mode 100644
index 0000000..ba32642
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt
@@ -0,0 +1,4 @@
+-- Check 1
+-- Check 2
+-- Check 2 - passed
+-- Check 1 - passed
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-test.c b/Tests/RunCMake/try_compile/ConfigureLog-test.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-test.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/try_compile/ConfigureLog.cmake b/Tests/RunCMake/try_compile/ConfigureLog.cmake
new file mode 100644
index 0000000..294e0f9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog.cmake
@@ -0,0 +1,25 @@
+enable_language(C)
+
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c
+ LOG_DESCRIPTION "Source that should not compile."
+ )
+
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ NO_LOG
+ )
+
+message(CHECK_START "Check 1")
+message(CHECK_START "Check 2")
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ LOG_DESCRIPTION "Source that should compile."
+ )
+if (COMPILE_RESULT)
+ message(CHECK_PASS "passed")
+ message(CHECK_PASS "passed")
+else()
+ message(CHECK_FAIL "failed")
+ message(CHECK_FAIL "failed")
+endif()
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
index b1344bd..b03e0b3 100644
--- a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
@@ -7,3 +7,11 @@ CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
COPY_FILE_ERROR must be followed by a variable name
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "LOG_DESCRIPTION":
+
+ empty string not allowed
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
index fda4f10..f0052c5 100644
--- a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
@@ -5,3 +5,6 @@ try_compile(RESULT ${try_compile_bindir_or_SOURCES}
try_compile(RESULT ${try_compile_bindir_or_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE "x" COPY_FILE_ERROR "")
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LOG_DESCRIPTION "")
diff --git a/Tests/RunCMake/try_compile/Inspect-config.txt b/Tests/RunCMake/try_compile/Inspect-config.txt
index 47169cf..e09fe55 100644
--- a/Tests/RunCMake/try_compile/Inspect-config.txt
+++ b/Tests/RunCMake/try_compile/Inspect-config.txt
@@ -8,6 +8,8 @@ events:
- "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "Inspect.cmake:[0-9]+ \(enable_language\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting C compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -23,6 +25,8 @@ events:
- "[^"]*/Modules/CMakeTestCXXCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "Inspect.cmake:[0-9]+ \(enable_language\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting CXX compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
diff --git a/Tests/RunCMake/try_compile/NoLogDescription-result.txt b/Tests/RunCMake/try_compile/NoLogDescription-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt
new file mode 100644
index 0000000..9005bcd
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at NoLogDescription.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "LOG_DESCRIPTION":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoLogDescription.cmake b/Tests/RunCMake/try_compile/NoLogDescription.cmake
new file mode 100644
index 0000000..904763f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription.cmake
@@ -0,0 +1,4 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LOG_DESCRIPTION)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index ad1cc29..51ccac8 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake_with_options(Inspect
)
include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+run_cmake(ConfigureLog)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
index 3158e32..0e4cc20 100644
--- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -12,6 +12,7 @@ run_cmake(NoCopyFile)
run_cmake(NoCopyFile2)
run_cmake(NoCopyFileError)
run_cmake(NoCStandard)
+run_cmake(NoLogDescription)
run_cmake(NoOutputVariable)
run_cmake(NoOutputVariable2)
run_cmake(BadLinkLibraries)
diff --git a/Tests/RunCMake/try_run/ConfigureLog-config.txt b/Tests/RunCMake/try_run/ConfigureLog-config.txt
index 602437e..ba396e0 100644
--- a/Tests/RunCMake/try_run/ConfigureLog-config.txt
+++ b/Tests/RunCMake/try_run/ConfigureLog-config.txt
@@ -7,6 +7,8 @@ events:
- "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)"
- "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "CMakeLists.txt:[0-9]+ \(project\)"
+ checks:
+ - "Detecting C compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -20,6 +22,7 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Source that should not compile\."
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -36,6 +39,9 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 1"
+ description: "Source that should compile\."
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -57,6 +63,9 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 2"
+ - "Check 1"
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
diff --git a/Tests/RunCMake/try_run/ConfigureLog-stdout.txt b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt
new file mode 100644
index 0000000..ba32642
--- /dev/null
+++ b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt
@@ -0,0 +1,4 @@
+-- Check 1
+-- Check 2
+-- Check 2 - passed
+-- Check 1 - passed
diff --git a/Tests/RunCMake/try_run/ConfigureLog.cmake b/Tests/RunCMake/try_run/ConfigureLog.cmake
index 4b5c7cb..6635d73 100644
--- a/Tests/RunCMake/try_run/ConfigureLog.cmake
+++ b/Tests/RunCMake/try_run/ConfigureLog.cmake
@@ -1,15 +1,31 @@
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c
+ LOG_DESCRIPTION "Source that should not compile."
)
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ NO_LOG
)
+message(CHECK_START "Check 1")
+try_run(RUN_RESULT COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ LOG_DESCRIPTION "Source that should compile."
+ )
+
+message(CHECK_START "Check 2")
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
RUN_OUTPUT_VARIABLE RUN_OUTPUT
)
+if (RUN_RESULT)
+ message(CHECK_PASS "passed")
+ message(CHECK_PASS "passed")
+else()
+ message(CHECK_FAIL "failed")
+ message(CHECK_FAIL "failed")
+endif()
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c