summaryrefslogtreecommitdiffstats
path: root/cmake/modules/Findlilv.cmake
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-01-24 16:14:46 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2021-01-24 16:14:46 +0100
commitf3b855e6da32043ffb1066547b53b15aac2e7e92 (patch)
treed644e489d6905268aa93edc53be1d16a1a40bbc8 /cmake/modules/Findlilv.cmake
parent75b52c2bbbadc14a7da57f686091cb708e5e7543 (diff)
parent82fd196e7c9b33eff79cdbc9f052407d28e2df75 (diff)
Merge remote-tracking branch 'upstream/2.3' into main
Diffstat (limited to 'cmake/modules/Findlilv.cmake')
-rw-r--r--cmake/modules/Findlilv.cmake88
1 files changed, 88 insertions, 0 deletions
diff --git a/cmake/modules/Findlilv.cmake b/cmake/modules/Findlilv.cmake
new file mode 100644
index 0000000000..15cd4571ca
--- /dev/null
+++ b/cmake/modules/Findlilv.cmake
@@ -0,0 +1,88 @@
+# This file is part of Mixxx, Digital DJ'ing software.
+# Copyright (C) 2001-2020 Mixxx Development Team
+# Distributed under the GNU General Public Licence (GPL) version 2 or any later
+# later version. See the LICENSE file for details.
+
+#[=======================================================================[.rst:
+Findlilv
+--------
+
+Finds the lilv library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``lilv::lilv``
+ The lilv library
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables:
+
+``lilv_FOUND``
+ True if the system has the lilv library.
+``lilv_INCLUDE_DIRS``
+ Include directories needed to use lilv.
+``lilv_LIBRARIES``
+ Libraries needed to link to lilv.
+``lilv_DEFINITIONS``
+ Compile definitions needed to use lilv.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``lilv_INCLUDE_DIR``
+ The directory containing ``lilv-0/lilb/lilv.h``.
+``lilv_LIBRARY``
+ The path to the lilv library.
+
+#]=======================================================================]
+
+find_package(PkgConfig QUIET)
+if(PkgConfig_FOUND)
+ pkg_check_modules(PC_lilv QUIET lilv-0)
+endif()
+
+find_path(lilv_INCLUDE_DIR
+ NAMES lilv/lilv.h
+ PATH_SUFFIXES lilv-0
+ PATHS ${PC_lilv_INCLUDE_DIRS}
+ DOC "lilv include directory"
+)
+mark_as_advanced(lilv_INCLUDE_DIR)
+
+find_library(lilv_LIBRARY
+ NAMES lilv-0 lilv
+ PATHS ${PC_lilv_LIBRARY_DIRS}
+ DOC "lilv library"
+)
+mark_as_advanced(lilv_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ lilv
+ DEFAULT_MSG
+ lilv_LIBRARY
+ lilv_INCLUDE_DIR
+)
+
+if(lilv_FOUND)
+ set(lilv_LIBRARIES "${lilv_LIBRARY}")
+ set(lilv_INCLUDE_DIRS "${lilv_INCLUDE_DIR}")
+ set(lilv_DEFINITIONS ${PC_lilv_CFLAGS_OTHER})
+
+ if(NOT TARGET lilv::lilv)
+ add_library(lilv::lilv UNKNOWN IMPORTED)
+ set_target_properties(lilv::lilv
+ PROPERTIES
+ IMPORTED_LOCATION "${lilv_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_lilv_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${lilv_INCLUDE_DIR}"
+ )
+ endif()
+endif()