ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Found the answer in some loosely related topics. I can't explain WHY this works, but it does.

You need to use a package finding .cmake module for ffmpeg. You can find one here:

https: //code.google.com/r/kyberneticist-webport/source/browse/cmake_modules/FindFFMPEG.cmake?spec=svn0ac281e1b58bc17027d733c1bb61b97e571cd287&r=0ac281e1b58bc17027d733c1bb61b97e571cd287

After the find_package( ) for catkin, set the CMAKE_MODULE_PATH variable to where you put the FindFFMPEG.cmake file, assuming your project is "ardrone_2":

set(CMAKE_MODULE_PATH ${ardrone_2_SOURCE_DIR})

Then use find_package on FFMPEG:

find_package(FFMPEG)

The FindFFMPEG.cmake file sets the FFMPEG_LIBRARIES variable:

set(FFMPEG_LIBRARIES
  ${FFMPEG_LIBAVCODEC}
  ${FFMPEG_LIBAVFORMAT}
  ${FFMPEG_LIBAVUTIL}
)

Setting the CMAKE_MODULE_PATH messes up the whatever directory cmake thinks it's in, so you need to specify absolute paths when you use add_executable( ), assuming your package is "ardrone_2":

add_executable(h264_decoder_node ${ardrone_2_SOURCE_DIR}/src/h264_decoder.cpp)

Then link using that variable:

target_link_libraries(h264_decoder_node ${catkin_LIBRARIES} ${FFMPEG_LIBRARIES} swscale)

Found the answer in some loosely related topics. I can't explain WHY this works, but it does.

You need to use a package finding .cmake module for ffmpeg. You can find one here:

https: //code.google.com/r/kyberneticist-webport/source/browse/cmake_modules/FindFFMPEG.cmake?spec=svn0ac281e1b58bc17027d733c1bb61b97e571cd287&r=0ac281e1b58bc17027d733c1bb61b97e571cd287//code.google.com/r/kyberneticist-webport/source/browse/cmake_modules/FindFFMPEG.cmake

After the find_package( ) for catkin, set the CMAKE_MODULE_PATH variable to where you put the FindFFMPEG.cmake file, assuming your project is "ardrone_2":

set(CMAKE_MODULE_PATH ${ardrone_2_SOURCE_DIR})

Then use find_package on FFMPEG:

find_package(FFMPEG)

The FindFFMPEG.cmake file sets the FFMPEG_LIBRARIES variable:

set(FFMPEG_LIBRARIES
  ${FFMPEG_LIBAVCODEC}
  ${FFMPEG_LIBAVFORMAT}
  ${FFMPEG_LIBAVUTIL}
)

Setting the CMAKE_MODULE_PATH messes up the whatever directory cmake thinks it's in, so you need to specify absolute paths when you use add_executable( ), assuming your package is "ardrone_2":

add_executable(h264_decoder_node ${ardrone_2_SOURCE_DIR}/src/h264_decoder.cpp)

Then link using that variable:

target_link_libraries(h264_decoder_node ${catkin_LIBRARIES} ${FFMPEG_LIBRARIES} swscale)