1 # - Try to find libxml++-2.6 |
1 # - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) |
2 # Once done this will define |
2 # Once done this will define |
3 # |
3 # |
4 # FFMPEG_FOUND - system has libxml++ |
4 # FFMPEG_FOUND - system has ffmpeg |
5 # FFMPEG_INCLUDE_DIRS - the libxml++ include directory |
5 # FFMPEG_INCLUDE_DIR - the ffmpeg include directory |
6 # FFMPEG_LIBRARIES - Link these to use libxml++ |
6 # FFMPEG_LIBRARIES - Link these to use ffmpeg |
7 # FFMPEG_DEFINITIONS - Compiler switches required for using libxml++ |
|
8 # |
7 # |
9 # Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> |
8 # Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> |
10 # Modified for other libraries by Lasse Kärkkäinen <tronic> |
9 # Modified for other libraries by Lasse Kärkkäinen <tronic> |
11 # Modified for Hedgewars by Stepik777 |
10 # Modified for Hedgewars by Stepik777 |
12 # |
11 # |
13 # Redistribution and use is allowed according to the terms of the New |
12 # Redistribution and use is allowed according to the terms of the New |
14 # BSD license. |
13 # BSD license. |
15 # |
14 # |
16 |
15 |
17 if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS) |
16 if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
18 # in cache already |
17 # in cache already |
19 set(FFMPEG_FOUND TRUE) |
18 set(FFMPEG_FOUND TRUE) |
20 else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS) |
19 else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
21 # use pkg-config to get the directories and then use these values |
20 # use pkg-config to get the directories and then use these values |
22 # in the FIND_PATH() and FIND_LIBRARY() calls |
21 # in the FIND_PATH() and FIND_LIBRARY() calls |
23 find_package(PkgConfig) |
22 find_package(PkgConfig) |
24 if (PKG_CONFIG_FOUND) |
23 if (PKG_CONFIG_FOUND) |
25 pkg_check_modules(_FFMPEG_AVCODEC libavcodec) |
24 pkg_check_modules(_FFMPEG_AVCODEC libavcodec) |
26 pkg_check_modules(_FFMPEG_AVFORMAT libavformat) |
25 pkg_check_modules(_FFMPEG_AVFORMAT libavformat) |
27 pkg_check_modules(_FFMPEG_AVUTIL libavutil) |
26 pkg_check_modules(_FFMPEG_AVUTIL libavutil) |
28 endif (PKG_CONFIG_FOUND) |
27 endif (PKG_CONFIG_FOUND) |
29 |
28 |
30 find_path(FFMPEG_AVCODEC_INCLUDE_DIR |
29 find_path(FFMPEG_AVCODEC_INCLUDE_DIR |
31 NAMES avcodec.h |
30 NAMES libavcodec/avcodec.h |
32 PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include |
31 PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include |
33 PATH_SUFFIXES ffmpeg libavcodec |
32 PATH_SUFFIXES ffmpeg libav |
34 ) |
|
35 |
|
36 find_path(FFMPEG_AVFORMAT_INCLUDE_DIR |
|
37 NAMES avformat.h |
|
38 PATHS ${_FFMPEG_AVFORMAT_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include |
|
39 PATH_SUFFIXES ffmpeg libavformat |
|
40 ) |
33 ) |
41 |
34 |
42 find_library(FFMPEG_AVCODEC_LIBRARY |
35 find_library(FFMPEG_AVCODEC_LIBRARY |
43 NAMES avcodec |
36 NAMES avcodec |
44 PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib |
37 PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib |
57 if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY) |
50 if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY) |
58 set(FFMPEG_FOUND TRUE) |
51 set(FFMPEG_FOUND TRUE) |
59 endif (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY) |
52 endif (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY) |
60 |
53 |
61 if (FFMPEG_FOUND) |
54 if (FFMPEG_FOUND) |
62 |
55 set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}/..) |
63 set(FFMPEG_INCLUDE_DIR |
|
64 ${FFMPEG_AVCODEC_INCLUDE_DIR} |
|
65 ${FFMPEG_AVFORMAT_INCLUDE_DIR} |
|
66 ) |
|
67 |
56 |
68 set(FFMPEG_LIBRARIES |
57 set(FFMPEG_LIBRARIES |
69 ${FFMPEG_AVCODEC_LIBRARY} |
58 ${FFMPEG_AVCODEC_LIBRARY} |
70 ${FFMPEG_AVFORMAT_LIBRARY} |
59 ${FFMPEG_AVFORMAT_LIBRARY} |
71 ${FFMPEG_AVUTIL_LIBRARY} |
60 ${FFMPEG_AVUTIL_LIBRARY} |
73 |
62 |
74 endif (FFMPEG_FOUND) |
63 endif (FFMPEG_FOUND) |
75 |
64 |
76 if (FFMPEG_FOUND) |
65 if (FFMPEG_FOUND) |
77 if (NOT FFMPEG_FIND_QUIETLY) |
66 if (NOT FFMPEG_FIND_QUIETLY) |
78 message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}") |
67 message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}") |
79 endif (NOT FFMPEG_FIND_QUIETLY) |
68 endif (NOT FFMPEG_FIND_QUIETLY) |
80 else (FFMPEG_FOUND) |
69 else (FFMPEG_FOUND) |
81 if (FFMPEG_FIND_REQUIRED) |
70 if (FFMPEG_FIND_REQUIRED) |
82 message(FATAL_ERROR "Could not find FFMPEG libavcodec, libavformat or libswscale") |
71 message(FATAL_ERROR "Could not find FFMPEG libavcodec, libavformat or libswscale") |
83 endif (FFMPEG_FIND_REQUIRED) |
72 endif (FFMPEG_FIND_REQUIRED) |
84 endif (FFMPEG_FOUND) |
73 endif (FFMPEG_FOUND) |
85 |
74 |
86 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS) |
75 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) |
87 |
76 |