summaryrefslogtreecommitdiffstats
path: root/project/cmake/modules/FindBluray.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/modules/FindBluray.cmake')
-rw-r--r--project/cmake/modules/FindBluray.cmake57
1 files changed, 57 insertions, 0 deletions
diff --git a/project/cmake/modules/FindBluray.cmake b/project/cmake/modules/FindBluray.cmake
new file mode 100644
index 0000000..2b0a449
--- /dev/null
+++ b/project/cmake/modules/FindBluray.cmake
@@ -0,0 +1,57 @@
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 libblueray library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(BLURAY libbluray>=0.7.0)
19 set(BLURAY_VERSION ${PC_BLURAY_VERSION})
20else()
21 find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
22 PATHS ${PC_BLURAY_INCLUDEDIR})
23
24 include(FindPackageHandleStandardArgs)
25 if(NOT WIN32)
26 find_library(BLURAY_LIBRARY NAMES bluray
27 PATHS ${PC_BLURAY_LIBDIR})
28
29 find_package_handle_standard_args(BLURAY
30 REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR
31 VERSION_VAR BLURAY_VERSION)
32 else()
33 # Dynamically loaded DLL
34 find_package_handle_standard_args(BLURAY
35 REQUIRED_VARS BLURAY_INCLUDE_DIR
36 VERSION_VAR BLURAY_VERSION)
37 endif()
38endif()
39
40if(BLURAY_FOUND)
41 set(BLURAY_LIBRARIES ${BLURAY_LIBRARY})
42 set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR})
43 set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1)
44
45 if(NOT TARGET Bluray::Bluray)
46 add_library(Bluray::Bluray UNKNOWN IMPORTED)
47 if(BLURAY_LIBRARY)
48 set_target_properties(Bluray::Bluray PROPERTIES
49 IMPORTED_LOCATION "${BLURAY_LIBRARY}")
50 endif()
51 set_target_properties(Bluray::Bluray PROPERTIES
52 INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}"
53 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1)
54 endif()
55endif()
56
57mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY)