Difference between revisions of "Integrating external libraries"

From Wiki for iCub and Friends
Jump to: navigation, search
(OpenCV)
Line 19: Line 19:
 
   FIND_PACKAGE(OpenCV)
 
   FIND_PACKAGE(OpenCV)
 
   INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
 
   INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
   LINK_LIBRARIES(${OPENCV_LIBRARY})
+
   LINK_LIBRARIES(${OPENCV_LIBRARIES})
 
   ADD_EXECUTABLE(kibitzer main.cpp)
 
   ADD_EXECUTABLE(kibitzer main.cpp)
  

Revision as of 12:03, 24 July 2006

Notes on integrating external libraries in a CMake project.

OpenCV

Eric has commited a "FindOpenCV.cmake" script in:

 iCub/src/vvv/emislive/CMakeModules

If you include opencv and yarp/sig header files in the same file, make sure you put the following line at the top of your program:

 #define YARP_CVTYPES_H_

This will prevent YARP's local copy of the IPL types conflicting with OpenCV. The two are the same. An example CMakeLists.txt (from Joerg):

 PROJECT(kibitzer)
 SET(YARP_DIR "$ENV{YARP_ROOT}" CACHE LOCATION "where is your yarp build directory?")
 FIND_PACKAGE(YARP)
 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
 FIND_PACKAGE(OpenCV)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
 LINK_LIBRARIES(${OPENCV_LIBRARIES})
 ADD_EXECUTABLE(kibitzer main.cpp)

ImageMagick++

see example in YARP source code, example/imagemagick