diff options
Diffstat (limited to 'cmake/modules/FindCdio.cmake')
| -rw-r--r-- | cmake/modules/FindCdio.cmake | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cmake/modules/FindCdio.cmake b/cmake/modules/FindCdio.cmake new file mode 100644 index 0000000..3f0a867 --- /dev/null +++ b/cmake/modules/FindCdio.cmake | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindCdio | ||
| 3 | # -------- | ||
| 4 | # Finds the cdio library | ||
| 5 | # | ||
| 6 | # This will 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 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # CDIO::CDIO - The cdio library | ||
| 15 | |||
| 16 | if(PKG_CONFIG_FOUND) | ||
| 17 | pkg_check_modules(PC_CDIO libcdio libiso9660 QUIET) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | find_path(CDIO_INCLUDE_DIR NAMES cdio/cdio.h | ||
| 21 | PATHS ${PC_CDIO_libcdio_INCLUDEDIR} | ||
| 22 | ${PC_CDIO_libiso9660_INCLUDEDIR}) | ||
| 23 | find_library(CDIO_LIBRARY NAMES cdio libcdio | ||
| 24 | PATHS ${CDIO_libcdio_LIBDIR} ${CDIO_libiso9660_LIBDIR}) | ||
| 25 | |||
| 26 | set(CDIO_VERSION ${PC_CDIO_libcdio_VERSION}) | ||
| 27 | |||
| 28 | include(FindPackageHandleStandardArgs) | ||
| 29 | find_package_handle_standard_args(Cdio | ||
| 30 | REQUIRED_VARS CDIO_LIBRARY CDIO_INCLUDE_DIR | ||
| 31 | VERSION_VAR CDIO_VERSION) | ||
| 32 | |||
| 33 | if(CDIO_FOUND) | ||
| 34 | set(CDIO_LIBRARIES ${CDIO_LIBRARY}) | ||
| 35 | set(CDIO_INCLUDE_DIRS ${CDIO_INCLUDE_DIR}) | ||
| 36 | |||
| 37 | if(NOT TARGET CDIO::CDIO) | ||
| 38 | add_library(CDIO::CDIO UNKNOWN IMPORTED) | ||
| 39 | set_target_properties(CDIO::CDIO PROPERTIES | ||
| 40 | IMPORTED_LOCATION "${CDIO_LIBRARY}" | ||
| 41 | INTERFACE_INCLUDE_DIRECTORIES "${CDIO_INCLUDE_DIR}") | ||
| 42 | endif() | ||
| 43 | endif() | ||
| 44 | |||
| 45 | mark_as_advanced(CDIO_INCLUDE_DIR CDIO_LIBRARY) | ||
