In the the CMakeLists.txt you simply import caffe using
find_package(Caffe). In my case it always miraculously found the caffe files, without me giving any CAFFE_DIR params or anything like that. I don't know how cmake can know where caffe is located, but it always just worked. Then you can use the
Caffe_LIBRARIES,
Caffe_INCLUDE_DIRS and
Caffe_DEFINITIONS variables as you would for any other library in cmake. For more info look at the header of the file
yourcaffeinstallfolder/share/Caffe/CaffeConfig.cmake.
If you need an example on how to use the C++ API of caffe, look at the code of the command line utility "caffe", which is usually used for training networks:
https://github.com/BVLC/caffe/blob/master/tools/caffe.cppJan