Show
Ignore:
Timestamp:
03/23/09 16:48:19 (4 years ago)
Author:
robert
Message:

From David Callu, clean up of FindFFmpeg include paths

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/CMakeModules/FindFFmpeg.cmake

    r9866 r9948  
    1010# Created by Robert Osfield. 
    1111 
     12 
     13#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>" 
     14#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg 
     15 
     16#We have to search the path which contain the header.h (usefull for old version) 
     17#and search the path which contain the libname/header.h (usefull for new version) 
     18 
     19#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code) 
     20#                                                       (in new version case, use by ffmpeg header)  
     21#and ${FFMPEG_libname_INCLUDE_DIRS/libname}             (in new version case, use by osg plugin code) 
     22 
     23 
    1224# Macro to find header and lib directories 
    1325# example: FFMPEG_FIND(AVFORMAT avformat avformat.h) 
    14  
    1526MACRO(FFMPEG_FIND varname shortname headername) 
    16     # First try to find header directly in include directory 
     27    # old version of ffmpeg put header in $prefix/include/[ffmpeg] 
     28    # so try to find header in include directory 
    1729    FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername} 
     30        PATHS 
    1831        ${FFMPEG_ROOT}/include 
    1932        $ENV{FFMPEG_DIR}/include 
     
    2336        /Library/Frameworks 
    2437        /usr/local/include 
    25         /usr/include/ 
     38        /usr/include 
    2639        /sw/include # Fink 
    2740        /opt/local/include # DarwinPorts 
     
    2942        /opt/include 
    3043        /usr/freeware/include 
     44        PATH_SUFFIXES ffmpeg 
     45        DOC "Location of FFMPEG Headers" 
    3146    ) 
    3247 
    33     # If not found, try to find it in a subdirectory. Tanguy's build has 
    34     # avformat.h in include/libavformat, so this catches that case. If that's 
    35     # standard, perhaps we can keep just this case. 
     48    # newer version of ffmpeg put header in $prefix/include/[ffmpeg/]lib${shortname} 
     49    # so try to find lib${shortname}/header in include directory 
    3650    IF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    3751        FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} 
     
    4963            /opt/include 
    5064            /usr/freeware/include 
    51         ) 
    52     ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    53  
    54  
    55     # If not found, try to find it in a subdirectory. Tanguy's build has 
    56     # avformat.h in include/libavformat, so this catches that case. If that's 
    57     # standard, perhaps we can keep just this case. 
    58     IF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
    59         FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ffmpeg/${headername} 
    60             ${FFMPEG_ROOT}/include 
    61             $ENV{FFMPEG_DIR}/include 
    62             $ENV{OSGDIR}/include 
    63             $ENV{OSG_ROOT}/include 
    64             ~/Library/Frameworks 
    65             /Library/Frameworks 
    66             /usr/local/include 
    67             /usr/include/ 
    68             /sw/include # Fink 
    69             /opt/local/include # DarwinPorts 
    70             /opt/csw/include # Blastwave 
    71             /opt/include 
    72             /usr/freeware/include 
     65            PATH_SUFFIXES ffmpeg 
     66            DOC "Location of FFMPEG Headers" 
    7367        ) 
    7468    ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS) 
     
    9286        /opt/lib 
    9387        /usr/freeware/lib64 
     88        DOC "Location of FFMPEG Libraries" 
    9489    ) 
    9590 
    96     IF   (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) 
     91    IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS) 
    9792        SET(FFMPEG_${varname}_FOUND 1) 
    9893    ENDIF(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)