Add FreeImage dependency and find the proper thread library on Windows.