In the Three Kingdoms Period (220-280), Cao Cao was once on a campaign during which his men failed to find any water. Cao Cao told them: "There are plum trees ahead. The sweet and sour plums will relieve your thirst." Hearing this, the soldiers thought of the plums and their mouths watered. This cured their thirst.
三国时代,有一次曹操带领军队去打仗。在行军的路上,找不到水源,士兵们都感到口渴难忍。曹操想出一个计策,指着前面一片树林说:“那里就是一大片梅林,树上的梅子又甜又酸,可以解渴。”士兵们听了,想起梅子的酸味,一个个都留出了口水,再也不觉的口渴了。
This idiom means to comfort oneself with fantasy.
“望梅止渴”这个成语比喻用空想来安慰自己。