OpenCV2.1 sample cmake

Install OpenCV2.1

http://d.hatena.ne.jp/niitsuma/20080209/1269351137

then sample codes installed /usr/local/share/sample
c sample /usr/local/share/sample/c
Add CMakeLists.txt in /usr/local/share/sample/c/
as

INCLUDE_DIRECTORIES(/usr/local/include/opencv)
SET(OpenCV_INCLUDE_DIRS /usr/local/include/opencv)
LINK_DIRECTORIES("/usr/local/lib")
SET(OpenCV_LIB_DIR "/usr/local/lib")

#example for contours.c
PROJECT(contours)
ADD_EXECUTABLE(contours contours.c)
TARGET_LINK_LIBRARIES(contours cv cxcore highgui)

then

cmake .
make

make executable "contours"