summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindBluray.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindBluray.cmake')
-rw-r--r--cmake/modules/FindBluray.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/cmake/modules/FindBluray.cmake b/cmake/modules/FindBluray.cmake
new file mode 100644
index 0000000..0bba128
--- /dev/null
+++ b/cmake/modules/FindBluray.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindBluray
3# ----------
4# Finds the libbluray library
5#
6# This will will define the following variables::
7#
8# BLURAY_FOUND - system has libbluray
9# BLURAY_INCLUDE_DIRS - the libbluray include directory
10# BLURAY_LIBRARIES - the libbluray libraries
11# BLURAY_DEFINITIONS - the libbluray compile definitions
12#
13# and the following imported targets::
14#
15# Bluray::Bluray - The libbluray library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_BLURAY libbluray>=0.7.0 QUIET)
19endif()
20
21find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
22 PATHS ${PC_BLURAY_INCLUDEDIR})
23
24set(BLURAY_VERSION ${PC_BLURAY_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(BLURAY_LIBRARY NAMES bluray
29 PATHS ${PC_BLURAY_LIBDIR})
30
31 find_package_handle_standard_args(Bluray
32 REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR
33 VERSION_VAR BLURAY_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(Bluray
37 REQUIRED_VARS BLURAY_INCLUDE_DIR
38 VERSION_VAR BLURAY_VERSION)
39endif()
40
41if(BLURAY_FOUND)
42 set(BLURAY_LIBRARIES ${BLURAY_LIBRARY})
43 set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR})
44 set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1)
45
46 if(NOT TARGET Bluray::Bluray)
47 add_library(Bluray::Bluray UNKNOWN IMPORTED)
48 if(BLURAY_LIBRARY)
49 set_target_properties(Bluray::Bluray PROPERTIES
50 IMPORTED_LOCATION "${BLURAY_LIBRARY}")
51 endif()
52 set_target_properties(Bluray::Bluray PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1)
55 endif()
56endif()
57
58mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY)