summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake.1.rst14
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx13
-rw-r--r--Source/cmMakefile.cxx3
-rwxr-xr-xTests/RunCMake/CommandLine/trace-json-v1-check.py12
6 files changed, 38 insertions, 12 deletions
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 4315f0a..44b1f2f 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -279,7 +279,9 @@ Options
"file": "/full/path/to/the/CMake/file.txt",
"line": 0,
"cmd": "add_executable",
- "args": ["foo", "bar"]
+ "args": ["foo", "bar"],
+ "time": 1579512535.9687231,
+ "frame": 2
}
The members are:
@@ -288,8 +290,8 @@ Options
The full path to the CMake source file where the function
was called.
- ``line``
- The line in `file` of the function call.
+ ``line``
+ The line in ``file`` of the function call.
``cmd``
The name of the function that was called.
@@ -297,6 +299,12 @@ Options
``args``
A string list of all function parameters.
+ ``time``
+ Timestamp (seconds since epoch) of the function call.
+
+ ``frame``
+ Stack frame depth of the function that was called.
+
Additionally, the first JSON document outputted contains the
``version`` key for the current major and minor version of the
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index a7c3eae..a078049 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -289,10 +289,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
string(TOLOWER ${_NAME} _NAME_LOWER)
if(FPHSA_FOUND_VAR)
- if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
+ set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND)
+ set(_FOUND_VAR_MIXED ${_NAME}_FOUND)
+ if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER)
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
else()
- message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
+ message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.")
endif()
else()
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 47b13af..103129a 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 16)
-set(CMake_VERSION_PATCH 20200123)
+set(CMake_VERSION_PATCH 20200124)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0911cd0..308644e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -549,10 +549,19 @@ void cmGlobalNinjaGenerator::Generate()
}
};
- if (this->NinjaSupportsCleanDeadTool) {
+ // The `cleandead` tool needs to know about all outputs in the build we just
+ // wrote out. Ninja-Multi doesn't have a single `build.ninja` we can use that
+ // is the union of all generated configurations, so we can't run it reliably
+ // in that case.
+ if (this->NinjaSupportsCleanDeadTool && !this->IsMultiConfig()) {
run_ninja_tool({ "cleandead" });
}
- if (this->NinjaSupportsUnconditionalRecompactTool) {
+ // The `recompact` tool loads the manifest. As above, we don't have a single
+ // `build.ninja` to load for this in Ninja-Multi. This may be relaxed in the
+ // future pending further investigation into how Ninja works upstream
+ // (ninja#1721).
+ if (this->NinjaSupportsUnconditionalRecompactTool &&
+ !this->IsMultiConfig()) {
run_ninja_tool({ "recompact" });
}
if (this->NinjaSupportsRestatTool) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 668a27d..59995be 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -340,6 +340,9 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
for (std::string const& arg : args) {
val["args"].append(arg);
}
+ val["time"] = cmSystemTools::GetTime();
+ val["frame"] =
+ static_cast<std::uint64_t>(this->ExecutionStatusStack.size());
msg << Json::writeString(builder, val);
#endif
break;
diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.py b/Tests/RunCMake/CommandLine/trace-json-v1-check.py
index 14febaf..e617b76 100755
--- a/Tests/RunCMake/CommandLine/trace-json-v1-check.py
+++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.py
@@ -46,6 +46,7 @@ required_traces = [
{
'args': msg_args,
'cmd': 'message',
+ 'frame': 3 if expand else 2
},
]
@@ -59,14 +60,17 @@ with open(trace_file, 'r') as fp:
for i in fp.readlines():
line = json.loads(i)
- assert sorted(line.keys()) == ['args', 'cmd', 'file', 'line']
+ assert sorted(line.keys()) == ['args', 'cmd', 'file', 'frame', 'line', 'time']
assert isinstance(line['args'], list)
assert isinstance(line['cmd'], unicode)
assert isinstance(line['file'], unicode)
+ assert isinstance(line['frame'], int)
assert isinstance(line['line'], int)
+ assert isinstance(line['time'], float)
for j in required_traces:
- if j['cmd'] == line['cmd'] and j['args'] == line['args']:
- j['found'] = True
+ # Compare the subset of required keys with line
+ if {k: line[k] for k in j} == j:
+ required_traces.remove(j)
-assert all([x.get('found', False) == True for x in required_traces])
+assert not required_traces