+# names to required libraries, in a way that is easily accessed from CMake.
+""")
+ for ci in self.ordered_component_infos:
+ # We only write the information for libraries currently.
+ if ci.type_name != 'Library':
+ continue
+
+ f.write("""\
+set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
+ ci.get_prefixed_library_name(), " ".join(sorted(
+ dep.get_prefixed_library_name()
+ for dep in self.get_required_libraries_for_component(ci)))))
+
+ f.close()
+
+ def write_cmake_exports_fragment(self, output_path):
+ """
+ write_cmake_exports_fragment(output_path) -> None
+
+ Generate a CMake fragment which includes LLVMBuild library
+ dependencies expressed similarly to how CMake would write
+ them via install(EXPORT).
+ """
+
+ dependencies = list(self.get_fragment_dependencies())
+
+ # Write out the CMake exports fragment.
+ make_install_dir(os.path.dirname(output_path))
+ f = open(output_path, 'w')
+
+ f.write("""\
+# Explicit library dependency information.
+#
+# The following property assignments tell CMake about link
+# dependencies of libraries imported from LLVM.
+""")