Place the cmake config and version files in the right location.

This way, they can be found by setting the CMAKE_PREFIX_PATH to the
build directory.
Use export() to create build-dir Targets files.

.#!/usr/bin/env python

import os

handle = os.popen("git grep \"^project\"", "r")

info = handle.read().splitlines()

files = {}
packages = {}

for item in info:
  f, content = item.split(":", 1)
  a = content.split("project(")[1]
  b = a.split()[0]
  if b == "Quickbook":
    continue
  name = b.split("Boost")[1]

  if name[-1] == ")":
    name = name[:-1]

  handle = os.popen("git grep -h -e add_library --and -e \"INTERFACE\" " + f, "r")

  matches = handle.read().splitlines()

  packages[f] = name

  files[f] = []
  for match in matches:
    files[f].append(match.split("add_library(")[1].split()[0])

for f, libs in files.items():
  handle = open(f, "a")
  handle.write('''
export(TARGETS ''' + ' '.join(libs) + "\n  NAMESPACE boost::\n  FILE ${CMAKE_BINARY_DIR}/lib/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake)\n")
Fix some exports.

They are too smart for my script.