build: raise an error if pkg is not found

Changed FFmpeg, PCSC and PulseAudio cmake find to raise an error if
an required package was not found.
This commit is contained in:
Bernhard Miklautz 2012-01-27 02:13:08 +01:00
parent 29c7c69521
commit 7af5599113
3 changed files with 65 additions and 4 deletions

View File

@ -1 +1,41 @@
pkg_check_modules(FFMPEG libavcodec libavutil)
# - Try to find FFmpeg
# Using Pkg-config if available for path
#
# FFMPEG_FOUND - all required ffmpeg components found on system
# FFMPEG_INCLUDE_DIRS - combined include directories
# FFMPEG_LIBRARIES - combined libraries to link
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC libavcodec)
pkg_check_modules(AVUTIL libavutil)
endif ( PKG_CONFIG_FOUND )
# avcodec
find_path(AVCODEC_INCLUDE_DIR avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS}
PATH_SUFFIXES libavcodec )
find_library(AVCODEC_LIBRARY avcodec PATHS ${AVCODEC_LIBRARY_DIRS})
# avutil
find_path(AVUTIL_INCLUDE_DIR avutil.h PATHS ${AVUTIL_INCLUDE_DIRS}
PATH_SUFFIXES libavutil )
find_library(AVUTIL_LIBRARY avutil PATHS ${AVUTIL_LIBRARY_DIRS})
if(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY)
set(AVCODEC_FOUND TRUE)
endif()
if(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
set(AVUTIL_FOUND TRUE)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND)
if(FFMPEG_FOUND)
set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR})
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY})
endif()
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARYS)

View File

@ -1,3 +1,13 @@
pkg_check_modules(PCSC libpcsclite)
include(FindPkgConfig)
# TODO: pcsc version
if (PKG_CONFIG_FOUND)
pkg_check_modules(PCSC libpcsclite)
endif()
find_path(PCSC_INCLUDE_DIR pcsclite.h PATHS ${PCSC_INCLUDE_DIRS}
PATH_SUFFIXES PCSC )
find_library(PCSC_LIBRARY pcsclite PATHS ${PCSC_LIBRARY_DIRS})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC DEFAULT_MSG PCSC_INCLUDE_DIR PCSC_LIBRARY)
mark_as_advanced(PCSC_INCLUDE_DIR PCSC_LIBRARY)

View File

@ -1 +1,12 @@
pkg_check_modules(PULSEAUDIO libpulse)
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PULSEAUDIO libpulse)
endif()
find_path(PULSEAUDIO_INCLUDE_DIR pulseaudio.h PATHS ${PULSEAUDIO_INCLUDE_DIRS} PATH_SUFFIXES pulse )
find_library(PULSEAUDIO_LIBRARY pulse PATHS ${PULSEAUDIO_LIBRARY_DIRS})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PulseAudio DEFAULT_MSG PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)
mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)