pacmake_include(log)
pacmake_include(textfile)

function(pacmake_patch patchdir installdir package version)
	set(cmake_dir "${installdir}/lib/cmake")
	if(EXISTS ${cmake_dir})
		file(RENAME "${cmake_dir}/SDL2" "${cmake_dir}/SDL2_ttf")
		set(target_dir "${cmake_dir}/SDL2_ttf")
	elseif(EXISTS "${installdir}/cmake")
		set(target_dir "${installdir}/cmake")
	endif()
	if(target_dir)
		pacmake_textfile_replace("${target_dir}/SDL2_ttfConfig.cmake" "/SDL2_TTFTargets.cmake" "/SDL2_ttfTargets.cmake")
		pacmake_textfile_replace("${target_dir}/SDL2_ttfConfig.cmake" "Freetype" "freetype")
	endif()
endfunction(pacmake_patch)
