summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-07-13 18:20:07 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-10-27 19:17:23 (GMT)
commit3c3698b0e47277db2721cd78e499f4b4a22f7e00 (patch)
tree1fe75dffd2a900052835d2bd220f6ee233d9869f /Source
parent8a09723bffe41989c49991e1e98c4e33543c6307 (diff)
downloadCMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.zip
CMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.tar.gz
CMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.tar.bz2
FileAPI: Add information on file set installers
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileAPI.cxx3
-rw-r--r--Source/cmFileAPICodemodel.cxx49
2 files changed, 51 insertions, 1 deletions
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index d529f52..c1df992 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -686,7 +686,8 @@ std::string cmFileAPI::NoSupportedVersion(
// The "codemodel" object kind.
-static unsigned int const CodeModelV2Minor = 3;
+// Update Help/manual/cmake-file-api.7.rst when updating this constant.
+static unsigned int const CodeModelV2Minor = 4;
void cmFileAPI::BuildClientRequestCodeModel(
ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 147181e..40e1d2e 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -23,11 +23,13 @@
#include "cmCryptoHash.h"
#include "cmExportSet.h"
#include "cmFileAPI.h"
+#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmInstallDirectoryGenerator.h"
#include "cmInstallExportGenerator.h"
+#include "cmInstallFileSetGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallGenerator.h"
#include "cmInstallGetRuntimeDependenciesGenerator.h"
@@ -1043,6 +1045,53 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
installer["runtimeDependencySetType"] = "library";
break;
}
+ } else if (auto* installFileSet =
+ dynamic_cast<cmInstallFileSetGenerator*>(gen)) {
+ installer["type"] = "fileSet";
+ installer["destination"] = installFileSet->GetDestination(this->Config);
+
+ auto* fileSet = installFileSet->GetFileSet();
+ auto* target = installFileSet->GetTarget();
+
+ auto dirCges = fileSet->CompileDirectoryEntries();
+ auto dirs = fileSet->EvaluateDirectoryEntries(
+ dirCges, target->GetLocalGenerator(), this->Config, target);
+
+ auto entryCges = fileSet->CompileFileEntries();
+ std::map<std::string, std::vector<std::string>> entries;
+ for (auto const& entryCge : entryCges) {
+ fileSet->EvaluateFileEntry(dirs, entries, entryCge,
+ target->GetLocalGenerator(), this->Config,
+ target);
+ }
+
+ Json::Value files = Json::arrayValue;
+ for (auto const& it : entries) {
+ auto dir = it.first;
+ if (!dir.empty()) {
+ dir += '/';
+ }
+ for (auto const& file : it.second) {
+ files.append(this->DumpInstallerPath(
+ this->TopSource, file,
+ cmStrCat(dir, cmSystemTools::GetFilenameName(file))));
+ }
+ }
+ installer["paths"] = std::move(files);
+ installer["fileSetName"] = fileSet->GetName();
+ installer["fileSetType"] = fileSet->GetType();
+ installer["fileSetDirectories"] = Json::arrayValue;
+ for (auto const& dir : dirs) {
+ installer["fileSetDirectories"].append(
+ RelativeIfUnder(this->TopSource, dir));
+ }
+ installer["fileSetTarget"] = Json::objectValue;
+ installer["fileSetTarget"]["id"] = TargetId(target, this->TopBuild);
+ installer["fileSetTarget"]["index"] = this->TargetIndexMap[target];
+
+ if (installFileSet->GetOptional()) {
+ installer["isOptional"] = true;
+ }
}
// Add fields common to all install generators.