summaryrefslogtreecommitdiff
path: root/Source/cmExportFileGenerator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-04-10 14:14:05 -0400
committerKyle Edwards <kyle.edwards@kitware.com>2023-04-12 09:33:24 -0400
commit42e5be8cefd98e819df9b6a5edce7023007f305e (patch)
treef68528d4f489039dc40b64fa9548ee1272b53379 /Source/cmExportFileGenerator.cxx
parent83525bfd7a247b6daca4445fd4c003c2315f45ce (diff)
downloadcmake-42e5be8cefd98e819df9b6a5edce7023007f305e.tar.gz
install(EXPORT): Fall back to set_property(APPEND) for FILE_SET
FILE_SET was introduced in CMake 3.23, so install(EXPORT) puts it behind a version gate. However, this results in the include directories not being picked up by older versions of CMake. Fall back to set_property(APPEND) for versions of CMake older than 3.23. Fixes: #24787
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r--Source/cmExportFileGenerator.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 6e7ef4e735..511b28d393 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1309,7 +1309,22 @@ void cmExportFileGenerator::GenerateTargetFileSets(cmGeneratorTarget* gte,
<< this->GetFileSetFiles(gte, fileSet, te) << "\n";
}
- os << " )\nendif()\n\n";
+ os << " )\nelse()\n set_property(TARGET " << targetName
+ << "\n APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES";
+ 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 << "\n " << this->GetFileSetDirectories(gte, fileSet, te);
+ }
+ os << "\n )\nendif()\n\n";
}
}