mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-26 10:48:38 -06:00
cmake_file_api: New project command
Projects can use the new command to request file API replies for the current run. No query files are generated, the query is tracked internally. Replies are created in the file system at generation time in the usual way. Fixes: #24951
This commit is contained in:
@@ -978,3 +978,45 @@ Json::Value cmFileAPI::ReportCapabilities()
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
bool cmFileAPI::AddProjectQuery(cmFileAPI::ObjectKind kind,
|
||||
unsigned majorVersion, unsigned minorVersion)
|
||||
{
|
||||
switch (kind) {
|
||||
case ObjectKind::CodeModel:
|
||||
if (majorVersion != 2 || minorVersion > CodeModelV2Minor) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ObjectKind::Cache:
|
||||
if (majorVersion != 2 || minorVersion > CacheV2Minor) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ObjectKind::CMakeFiles:
|
||||
if (majorVersion != 1 || minorVersion > CMakeFilesV1Minor) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ObjectKind::Toolchains:
|
||||
if (majorVersion != 1 || minorVersion > ToolchainsV1Minor) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
// These cannot be requested by the project
|
||||
case ObjectKind::ConfigureLog:
|
||||
case ObjectKind::InternalTest:
|
||||
return false;
|
||||
}
|
||||
|
||||
Object query;
|
||||
query.Kind = kind;
|
||||
query.Version = majorVersion;
|
||||
if (std::find(this->TopQuery.Known.begin(), this->TopQuery.Known.end(),
|
||||
query) == this->TopQuery.Known.end()) {
|
||||
this->TopQuery.Known.emplace_back(query);
|
||||
this->QueryExists = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user