To keep the Q&A aspect:
I got a strange problem with the latest (v.2.4.2) OpenCV version, which failed to install with the following error:
In file included from /OpenCV-2.4.2/modules/core/src/system.cpp:460:
/OpenCV-2.4.2/release/modules/core/version_string.inc:37:1: warning: missing terminating " character In file included from /OpenCV-2.4.2/modules/core/src/system.cpp:460: /OpenCV-2.4.2/release/modules/core/version_string.inc:37: error: missing terminating " character
So what went wrong? Take a look at my answer.
Unfortunately newer cmake depends on newer cmake than the outdated cmake 2.6-patch 0 in lenny. To compile cmake 2.8.8 as mentioned above, first you have to compile CMake 2.6.3 or above which builds with lenny outdated cmake 2.6-patch 0.
As mentioned in this bug report the problem is an old version (2.8.2) of cmake. So the solution was to grab a fresh copy of the cmake source, compile it and use it to install OpenCV.
Note 18/09/2012: This also works on Ubuntu 12.04 with cmake 2.8.9!
That's it.