mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
instrumentation: Add project field to cmake content files
This commit is contained in:
@@ -563,6 +563,9 @@ corresponding to the CMake invocation responsible for generating its command.
|
||||
|
||||
Each CMake content file contains the following:
|
||||
|
||||
``project``
|
||||
The value of :variable:`CMAKE_PROJECT_NAME`.
|
||||
|
||||
``custom``
|
||||
An object containing arbitrary JSON data specified by the user with the
|
||||
:ref:`cmake_instrumentation CUSTOM_CONTENT` functionality of the
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "cmTimestamp.h"
|
||||
#include "cmUVProcessChain.h"
|
||||
#include "cmValue.h"
|
||||
#include "cmake.h"
|
||||
|
||||
using LoadQueriesAfter = cmInstrumentation::LoadQueriesAfter;
|
||||
|
||||
@@ -234,6 +235,8 @@ void cmInstrumentation::WriteCMakeContent(
|
||||
Json::Value root;
|
||||
root["targets"] = this->DumpTargets(gg);
|
||||
root["custom"] = this->customContent;
|
||||
root["project"] =
|
||||
gg->GetCMakeInstance()->GetCacheDefinition("CMAKE_PROJECT_NAME").GetCStr();
|
||||
this->WriteInstrumentationJson(
|
||||
root, "data/content",
|
||||
cmStrCat("cmake-", this->ComputeSuffixTime(), ".json"));
|
||||
|
||||
@@ -15,6 +15,9 @@ set(firstFile "")
|
||||
foreach(content_file IN LISTS content_files)
|
||||
read_json("${content_file}" contents)
|
||||
|
||||
# Check project name
|
||||
json_assert_key("${content_file}" "${contents}" project "instrumentation")
|
||||
|
||||
# Check custom content
|
||||
string(JSON custom GET "${contents}" custom)
|
||||
json_assert_key("${content_file}" "${custom}" myString "string")
|
||||
|
||||
Reference in New Issue
Block a user