parameters: (self, output_path, enabled_optional_components)
docstring: write_cmake_fragment(output_path) -> None
  
          Generate a CMake fragment which includes all of the collated LLVMBuild
          information in a format that is easily digestible by a CMake. The exact
          contents of this are closely tied to how the CMake configuration
          integrates LLVMBuild, see CMakeLists.txt in the top-level.
docstring_summary: write_cmake_fragment(output_path) -> None
docstring_tokens: write_cmake_fragment ( output_path ) - > None
function: def write_cmake_fragment(self, output_path, enabled_optional_components):
          """
          write_cmake_fragment(output_path) -> None
  
          Generate a CMake fragment which includes all of the collated LLVMBuild
          information in a format that is easily digestible by a CMake. The exact
          contents of this are closely tied to how the CMake configuration
          integrates LLVMBuild, see CMakeLists.txt in the top-level.
          """
  
          dependencies = list(self.get_fragment_dependencies())
  
          # Write out the CMake fragment.
          make_install_dir(os.path.dirname(output_path))
          f = open(output_path, 'w')
  
          # Write the header.
          header_fmt = '\
  #===-- %s - LLVMBuild Configuration for LLVM %s-*- CMake -*--===#'
          header_name = os.path.basename(output_path)
          header_pad = '-' * (80 - len(header_fmt % (header_name, '')))
          header_string = header_fmt % (header_name, header_pad)
          f.write("""\
  %s
  #
  #                     The LLVM Compiler Infrastructure
  #
  # This file is distributed under the University of Illinois Open Source
  # License. See LICENSE.TXT for details.
  #
  #===------------------------------------------------------------------------===#
  #
  # This file contains the LLVMBuild project information in a format easily
  # consumed by the CMake based build system.
  #
  # This file is autogenerated by llvm-build, do not edit!
  #
  #===------------------------------------------------------------------------===#
  
  """ % header_string)
  
          # Write the dependency information in the best way we can.
          f.write("""
  # LLVMBuild CMake fragment dependencies.
  #
  # CMake has no builtin way to declare that the configuration depends on
  # a particular file. However, a side effect of configure_file is to add
  # said input file to CMake's internal dependency list. So, we use that
  # and a dummy output file to communicate the dependency information to
  # CMake.
  #
  # FIXME: File a CMake RFE to get a properly supported version of this
  # feature.
  """)
          for dep in dependencies:
              f.write("""\
  configure_file(\"%s\"
                 ${CMAKE_CURRENT_BINARY_DIR}/DummyConfigureOutput)\n""" % (
                  cmake_quote_path(dep),))
  
          # Write the properties we use to encode the required library dependency
          # information in a form CMake can easily use directly.
          f.write("""
  # Explicit library dependency information.
  #
  # The following property assignments effectively create a map from component
  # names to required libraries, in a way that is easily accessed from CMake.
  """)
          self.foreach_cmake_library(
              lambda ci:
                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)))))
              ,
              enabled_optional_components,
              skip_disabled = False,
              skip_not_installed = False # Dependency info must be emitted for internals libs too
              )
  
          f.close()
function_tokens: def write_cmake_fragment ( self , output_path , enabled_optional_components ) : dependencies = list ( self . get_fragment_dependencies ( ) ) # Write out the CMake fragment. make_install_dir ( os . path . dirname ( output_path ) ) f = open ( output_path , 'w' ) # Write the header. header_fmt = '\
  #===-- %s - LLVMBuild Configuration for LLVM %s-*- CMake -*--===#' header_name = os . path . basename ( output_path ) header_pad = '-' * ( 80 - len ( header_fmt % ( header_name , '' ) ) ) header_string = header_fmt % ( header_name , header_pad ) f . write ( """\
  %s
  #
  #                     The LLVM Compiler Infrastructure
  #
  # This file is distributed under the University of Illinois Open Source
  # License. See LICENSE.TXT for details.
  #
  #===------------------------------------------------------------------------===#
  #
  # This file contains the LLVMBuild project information in a format easily
  # consumed by the CMake based build system.
  #
  # This file is autogenerated by llvm-build, do not edit!
  #
  #===------------------------------------------------------------------------===#
  
  """ % header_string ) # Write the dependency information in the best way we can. f . write ( """
  # LLVMBuild CMake fragment dependencies.
  #
  # CMake has no builtin way to declare that the configuration depends on
  # a particular file. However, a side effect of configure_file is to add
  # said input file to CMake's internal dependency list. So, we use that
  # and a dummy output file to communicate the dependency information to
  # CMake.
  #
  # FIXME: File a CMake RFE to get a properly supported version of this
  # feature.
  """ ) for dep in dependencies : f . write ( """\
  configure_file(\"%s\"
                 ${CMAKE_CURRENT_BINARY_DIR}/DummyConfigureOutput)\n""" % ( cmake_quote_path ( dep ) , ) ) # Write the properties we use to encode the required library dependency # information in a form CMake can easily use directly. f . write ( """
  # Explicit library dependency information.
  #
  # The following property assignments effectively create a map from component
  # names to required libraries, in a way that is easily accessed from CMake.
  """ ) self . foreach_cmake_library ( lambda ci : 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 ) ) ) ) ) , enabled_optional_components , skip_disabled = False , skip_not_installed = False # Dependency info must be emitted for internals libs too ) f . close ( )