1#.rst:
2# FindCdio
3# --------
4# Finds the cdio library
5#
6# This will define the following variables::
7#
8# CDIO_FOUND - system has cdio
9# CDIO_INCLUDE_DIRS - the cdio include directory
10# CDIO_LIBRARIES - the cdio libraries
11
12if(PKG_CONFIG_FOUND)
13  pkg_check_modules(PC_CDIO libcdio>=0.80 QUIET)
14  pkg_check_modules(PC_CDIOPP libcdio++>=2.1.0 QUIET)
15endif()
16
17find_path(CDIO_INCLUDE_DIR NAMES cdio/cdio.h
18                           PATHS ${PC_CDIO_INCLUDEDIR})
19
20find_library(CDIO_LIBRARY NAMES cdio libcdio
21                          PATHS ${PC_CDIO_LIBDIR})
22
23if(DEFINED PC_CDIO_VERSION AND DEFINED PC_CDIOPP_VERSION AND NOT "${PC_CDIO_VERSION}" VERSION_EQUAL "${PC_CDIOPP_VERSION}")
24  message(WARNING "Detected libcdio (${PC_CDIO_VERSION}) and libcdio++ (${PC_CDIOPP_VERSION}) version mismatch. libcdio++ will not be used.")
25else()
26  find_path(CDIOPP_INCLUDE_DIR NAMES cdio++/cdio.hpp
27                               PATHS ${PC_CDIOPP_INCLUDEDIR} ${CDIO_INCLUDE_DIR})
28
29  set(CDIO_VERSION ${PC_CDIO_VERSION})
30endif()
31
32include(FindPackageHandleStandardArgs)
33find_package_handle_standard_args(Cdio
34                                  REQUIRED_VARS CDIO_LIBRARY CDIO_INCLUDE_DIR
35                                  VERSION_VAR CDIO_VERSION)
36
37if(CDIO_FOUND)
38  set(CDIO_LIBRARIES ${CDIO_LIBRARY})
39  set(CDIO_INCLUDE_DIRS ${CDIO_INCLUDE_DIR})
40endif()
41
42mark_as_advanced(CDIO_INCLUDE_DIR CDIOPP_INCLUDE_DIR CDIO_LIBRARY)
43