aboutsummaryrefslogtreecommitdiff
path: root/modules/FindPhonon.cmake
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2011-06-28 17:13:05 -0400
committerAllen Winter <allen.winter@kdab.com>2011-06-28 17:13:05 -0400
commite15ffacc69242c89107afbfda6f8ece9f2b56633 (patch)
tree34bed177321c49f883d9d75616947a18f38c037f /modules/FindPhonon.cmake
parent5c79bed7250cb2f854bfb4f20e4d266925d94b54 (diff)
parentc06badd8d431583071cad638fea082ca0776a0a3 (diff)
downloadextra-cmake-modules-e15ffacc69242c89107afbfda6f8ece9f2b56633.tar.gz
extra-cmake-modules-e15ffacc69242c89107afbfda6f8ece9f2b56633.tar.bz2
Merge branch 'allen' of /data/kde/trunk/KDE/kdelibs
Diffstat (limited to 'modules/FindPhonon.cmake')
-rw-r--r--modules/FindPhonon.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/FindPhonon.cmake b/modules/FindPhonon.cmake
new file mode 100644
index 00000000..cd9e5cb4
--- /dev/null
+++ b/modules/FindPhonon.cmake
@@ -0,0 +1,37 @@
+# Find libphonon
+# Once done this will define
+#
+# PHONON_FOUND - system has Phonon Library
+# PHONON_INCLUDES - the Phonon include directory
+# PHONON_LIBS - link these to use Phonon
+# PHONON_VERSION - the version of the Phonon Library
+
+# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(_phonon_find_version)
+ set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
+ if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
+ string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
+ set(PHONON_VERSION "${CMAKE_MATCH_1}")
+endmacro(_phonon_find_version)
+
+# the dirs listed with HINTS are searched before the default sets of dirs
+find_library(PHONON_LIBRARY NAMES phonon HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR})
+find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR})
+
+if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
+ set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
+ _phonon_find_version()
+endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY)
+
+mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY)