I wrote a CMakeLists.txt like this
cmake_minimum_required (VERSION 2.6)
project (test-ocr)
# Add the including directory of the tesseract
# and please replace with your dir.
include_directories (/home/ytxie/include)
# Add the search directory for the tesseract library
# and please replace with your dir.
link_directories (/home/ytxie/lib)
add_executable (test-ocr test.cpp)
# link the leptonica library and the tesseract library
target_link_libraries (test-ocr lept tesseract)
I've add comments and it seems easy to understand. The test.cpp is just the that example code.
And if you want to add OpenCV relating setting into this cmake file, just add them. If there are some confusing things please read the CMake's document.
NOTE: to make the test-ocr run successfully, you should download the English data and copy it's content into the /share/tessdata.