1# - Try to find cdio_paranoia
2# Once done this will define
3#
4# CDIOPARANOIA_FOUND - system has libcdio_paranoia
5# CDIOPARANOIA_INCLUDE_DIRS - the libcdio_paranoia include directory
6# CDIOPARANOIA_LIBRARIES - The libcdio_paranoia libraries
7
8cmake_policy(SET CMP0075 NEW)
9cmake_policy(SET CMP0011 NEW)
10
11include(FindPkgConfig)
12include(CheckIncludeFiles)
13
14if(PKG_CONFIG_FOUND)
15  pkg_check_modules (CDIOPARANOIA libcdio_paranoia)
16  list(APPEND CDIOPARANOIA_INCLUDE_DIRS ${CDIOPARANOIA_INCLUDEDIR})
17endif()
18
19if (CDIOPARANOIA_FOUND)
20    check_include_files(cdio/paranoia.h HAVE_CDIO_PARANOIA_H)
21    check_include_files(cdio/cdda.h HAVE_CDIO_CDDA_H)
22    # Issue 1022 - sometimes its cdio/paranoia/paranoia.h
23    if (NOT HAVE_CDIO_PARANOIA_H)
24        check_include_files(cdio/paranoia/paranoia.h HAVE_CDIO_PARANOIA_PARANOIA_H)
25    endif()
26    if (NOT HAVE_CDIO_CDDA_H)
27        check_include_files(cdio/paranoia/cdda.h HAVE_CDIO_PARANOIA_CDDA_H)
28    endif()
29    if (NOT HAVE_CDIO_PARANOIA_H AND NOT HAVE_CDIO_PARANOIA_PARANOIA_H AND NOT HAVE_CDIO_CDDA_H AND NOT HAVE_CDIO_PARANOIA_CDDA_H)
30        set(CDIOPARANOIA_FOUND OFF)
31        message("Failed to determine cdio/paranoia header file location")
32    endif()
33endif()
34include(FindPackageHandleStandardArgs)
35find_package_handle_standard_args(CDIOPARANOIA DEFAULT_MSG CDIOPARANOIA_INCLUDE_DIRS CDIOPARANOIA_LIBRARIES)
36
37mark_as_advanced(CDIOPARANOIA_INCLUDE_DIRS CDIOPARANOIA_LIBRARIES)
38