old_contents: # BuildFox ninja generator
  
  cmake_ext_of_interest_src = (".c", ".cpp", ".cxx", ".c++", ".cc", ".h", ".hpp", ".hxx")
  
  def gen_cmake(all_files, defines, includedirs, prj_name, buildfox_name, filename = "CMakeLists.txt"):
  	text = r"""# generated by BuildFox
  cmake_minimum_required(VERSION 2.8.3)
  project(%s)
  include_directories("%s")
  add_custom_target(
    build
    ALL bf%s && ninja
    WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
    SOURCES "%s"
  )
  """
  
  	all_files = ["%s%s" % ("" if folder == "./" else folder, name)
  		for folder, names in all_files.items()
  			for name in names
  				if name.lower().endswith(cmake_ext_of_interest_src)]
  	all_files = [buildfox_name] + all_files
  	includedirs = ["."] + includedirs
  
  	with open(filename, "w") as f:
  		f.write(text % (
  			prj_name,
  			";".join(includedirs),
  			" -i " + buildfox_name if buildfox_name != "build.fox" else "",
  			";".join(all_files)
  		))
new_contents: # BuildFox ninja generator
  
  cmake_ext_of_interest_src = (".c", ".cpp", ".cxx", ".c++", ".cc", ".h", ".hpp", ".hxx")
  
  def gen_cmake(all_files, defines, includedirs, prj_name, buildfox_name, filename = "CMakeLists.txt"):
  	text = r"""# generated by BuildFox
  cmake_minimum_required(VERSION 2.8.3)
  project(%s)
  include_directories("%s")
  add_custom_target(
    build
    ALL ninja
    WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
    SOURCES "%s"
  )
  """
  
  	all_files = ["%s%s" % ("" if folder == "./" else folder, name)
  		for folder, names in all_files.items()
  			for name in names
  				if name.lower().endswith(cmake_ext_of_interest_src)]
  	all_files = [buildfox_name] + all_files
  	includedirs = ["."] + includedirs
  
  	with open(filename, "w") as f:
  		f.write(text % (
  			prj_name,
  			";".join(includedirs),
  			";".join(all_files)
  		))
subject: remove configure step from cmake