summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-06-18 18:44:46 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-10-27 19:17:23 (GMT)
commit2a78d47b16c8b7a3b599f1862cbab0de58575d84 (patch)
tree736a0d889a4c0cdf7d64779b1a3bce50feb9bb4b /Source/cmExportFileGenerator.cxx
parent9b479124cc4be49a4b2c6e45e733b489f7a26432 (diff)
downloadCMake-2a78d47b16c8b7a3b599f1862cbab0de58575d84.zip
CMake-2a78d47b16c8b7a3b599f1862cbab0de58575d84.tar.gz
CMake-2a78d47b16c8b7a3b599f1862cbab0de58575d84.tar.bz2
install(EXPORT): Install file sets
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r--Source/cmExportFileGenerator.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 9f38c12..896240c 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmsys/FStream.hxx"
#include "cmComputeLinkInformation.h"
+#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -1256,3 +1257,39 @@ bool cmExportFileGenerator::PopulateExportProperties(
}
return true;
}
+
+void cmExportFileGenerator::GenerateTargetFileSets(cmGeneratorTarget* gte,
+ std::ostream& os,
+ cmTargetExport* te)
+{
+ auto interfaceFileSets = gte->Target->GetAllInterfaceFileSets();
+ if (!interfaceFileSets.empty()) {
+ std::string targetName = cmStrCat(this->Namespace, gte->GetExportName());
+ os << "if(NOT CMAKE_VERSION VERSION_LESS \"" << DEVEL_CMAKE_VERSION(3, 23)
+ << "\")\n"
+ " target_sources("
+ << targetName << "\n";
+
+ for (auto const& name : interfaceFileSets) {
+ auto* fileSet = gte->Target->GetFileSet(name);
+ if (!fileSet) {
+ gte->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("File set \"", name,
+ "\" is listed in interface file sets of ", gte->GetName(),
+ " but has not been created"));
+ return;
+ }
+
+ os << " INTERFACE"
+ << "\n FILE_SET " << cmOutputConverter::EscapeForCMake(name)
+ << "\n TYPE "
+ << cmOutputConverter::EscapeForCMake(fileSet->GetType())
+ << "\n BASE_DIRS "
+ << this->GetFileSetDirectories(gte, fileSet, te) << "\n FILES "
+ << this->GetFileSetFiles(gte, fileSet, te) << "\n";
+ }
+
+ os << " )\nendif()\n\n";
+ }
+}