cmake: Fix FILE COPY for cmake < 2.8.0
compatibility: Use mkdtemp instead of g_mkdtemp.