
message(STATUS "Executing cleanup script")

macro(move_directory_content _src_dir _dest_dir _ext)
	message(STATUS "Moving content: ${_src_dir} to ${_dest_dir}")
	if(NOT EXISTS "${_src_dir}")
		message(FATAL_ERROR "Source directory does not exist: ${_src_dir}")
	elseif(NOT IS_DIRECTORY "${_src_dir}")
		message(FATAL_ERROR "Source path is not a directory: ${_src_dir}")
	elseif(EXISTS "${_dest_dir}")
		if(NOT IS_DIRECTORY "${_dest_dir}")
			message(FATAL_ERROR "Destination is not a directory: ${_dest_dir}")
		endif()
	else()
		file(MAKE_DIRECTORY "${_dest_dir}")
	endif()
	file(GLOB to_move "${_src_dir}/*${_ext}")
	foreach(_file ${to_move})
		file(RELATIVE_PATH rel_file "${_src_dir}" "${_file}")
		file(RENAME "${_file}" "${_dest_dir}/${rel_file}")
	endforeach()
endmacro()
