FindMPEG — CMake 4.4.2 Documentation

# FindMPEG

Finds the native MPEG library (libmpeg2):

    find_package(MPEG [...])

Note

This module is functionally identical to the `FindMPEG2` module, which also finds the libmpeg2 library. Both modules were introduced in the past to provide flexibility in handling potential differences in future versions of the MPEG library and to maintain backward compatibility across CMake releases.

The `FindMPEG2` module additionally checks for the SDL dependency and includes it in its usage requirements. For working with libmpeg2, it is recommended to use the `FindMPEG2` module instead of this one.

## Result Variables

This module defines the following variables:

`MPEG_FOUND`

  Boolean indicating whether the libmpeg2 library was found.

`MPEG_LIBRARIES`

  Libraries needed to link against to use libmpeg2.

## Cache Variables

The following cache variables may also be set:

`MPEG_INCLUDE_DIR`

  The directory containing the `mpeg2.h` and related headers needed to use libmpeg2 library.

`MPEG_mpeg2_LIBRARY`

  The path to the libmpeg2 library.

`MPEG_vo_LIBRARY`

  The path to the vo (Video Out) library.

## Examples

Finding libmpeg2 library and creating an imported interface target for linking it to a project target:

    find_package(MPEG)

    if(MPEG_FOUND AND NOT TARGET MPEG::MPEG)
      add_library(MPEG::MPEG INTERFACE IMPORTED)
      set_target_properties(
        MPEG::MPEG
        PROPERTIES
          INTERFACE_LINK_LIBRARIES "${MPEG_LIBRARIES}"
          INTERFACE_INCLUDE_DIRECTORIES "${MPEG_INCLUDE_DIR}"
      )
    endif()

    target_link_libraries(project_target PRIVATE MPEG::MPEG)