function(atomic_configure_file input output)
  set(atomic_file "${CMAKE_BINARY_DIR}/atomic_configure_file")
  configure_file("${input}" "${atomic_file}" ${ARGN})
  get_filename_component(output_path ${output} PATH)
  if(NOT EXISTS ${output_path})
    file(MAKE_DIRECTORY ${output_path})
  endif()
  file(RENAME "${atomic_file}" "${output}")
endfunction()
