diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-13 18:20:07 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-10-27 19:17:23 (GMT) |
commit | 3c3698b0e47277db2721cd78e499f4b4a22f7e00 (patch) | |
tree | 1fe75dffd2a900052835d2bd220f6ee233d9869f /Source/cmFileAPICodemodel.cxx | |
parent | 8a09723bffe41989c49991e1e98c4e33543c6307 (diff) | |
download | CMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.zip CMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.tar.gz CMake-3c3698b0e47277db2721cd78e499f4b4a22f7e00.tar.bz2 |
FileAPI: Add information on file set installers
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r-- | Source/cmFileAPICodemodel.cxx | 49 |
1 files changed, 49 insertions, 0 deletions
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. |