Browse Source

Merge topic 'export-file-set-old-cmake-versions'

42e5be8cef install(EXPORT): Fall back to set_property(APPEND) for FILE_SET

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !8408
Craig Scott 2 years ago
parent
commit
b79c444e53
1 changed files with 16 additions and 1 deletions
  1. 16 1
      Source/cmExportFileGenerator.cxx

+ 16 - 1
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";
   }
 }