[Phonon] 0532638 This is a terrible hack to make phonon-xine find p

Andreas Hartmetz ahartmetz at gmail.com
Sat Dec 25 03:08:18 CET 2010


commit 053263861a07e30e54a6874355465c111c4d9653
branch master
Author: Andreas Hartmetz <ahartmetz at gmail.com>
Date:   Sat Dec 25 02:57:35 2010 +0100

    This is a terrible hack to make phonon-xine find phonon.
    
    - Copied a few lines from FindKDE4.cmake to find kde4-config
    - Copied a few lines from FindKDE4Internal.cmake to use kde4-config
      to find the CMake module path used by KDE, where FindPhonon.cmake
      is located.
    - Added dependency on Phonon
    - Replaced ${PHONON_LIBs} withs ${PHONON_LIBRARY} in target_link_libraries,
      because that's the variable set by FindPhonon.cmake
    - Added missing ${QT_QTDBUS_LIBRARY} to target_link_libraries
      (might have something to do with the gold linker that I use)
    
    I think FindPhonon.cmake being installed by kdelibs, into a
    KDE-specific path, is the underlying problem that needs to
    be fixed. Looks like a circular dependency of sorts to me.
    We're going to see similar problems in the future with kdesupport
    fragmenting more and more.
    CCMAIL:kde-buildsystem at kde.org

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b49b8e1..2ccf1ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,6 +153,47 @@ if (CMAKE_COMPILER_IS_GNUCXX)
 
 endif (CMAKE_COMPILER_IS_GNUCXX)
 
+# set the KDE-specific CMake module paths to find FindPhonon.cmake
+
+FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
+   # the suffix must be used since KDEDIRS can be a list of directories
+   # which don't have bin/ appended
+   PATH_SUFFIXES bin
+   HINTS
+   ${CMAKE_INSTALL_PREFIX}
+   ${_KDEDIRS}
+   ONLY_CMAKE_FIND_ROOT_PATH
+   )
+
+IF (NOT KDE4_KDECONFIG_EXECUTABLE)
+   IF (KDE4_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
+   ENDIF (KDE4_FIND_REQUIRED)
+ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
+
+execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+   file(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
+   foreach(dir ${_data_DIR})
+      set (apath "${dir}/cmake/modules")
+      if (EXISTS "${apath}")
+         set (included 0)
+         string(TOLOWER "${apath}" _apath)
+         # ignore already added pathes, case insensitive
+         foreach(adir ${CMAKE_MODULE_PATH})
+            string(TOLOWER "${adir}" _adir)
+            if ("${_adir}" STREQUAL "${_apath}")
+               set (included 1)
+            endif ("${_adir}" STREQUAL "${_apath}")
+         endforeach(adir)
+         if (NOT included)
+            message(STATUS "Adding ${apath} to CMAKE_MODULE_PATH")
+            set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${apath}")
+         endif (NOT included)
+      endif (EXISTS "${apath}")
+   endforeach(dir)
+
+find_package(Phonon REQUIRED)
+
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 set(CMAKE_COLOR_MAKEFILE ON)
diff --git a/xine/CMakeLists.txt b/xine/CMakeLists.txt
index b437c81..7c10d90 100644
--- a/xine/CMakeLists.txt
+++ b/xine/CMakeLists.txt
@@ -97,7 +97,7 @@ configure_file(config-xine-widget.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-xin
 add_definitions(-DPHONON_BACKEND_VERSION_4_4)
 automoc4_add_library(phonon_xine MODULE ${phonon_xine_SRCS})
 set_target_properties(phonon_xine PROPERTIES PREFIX "")
-target_link_libraries(phonon_xine ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${PHONON_LIBS} ${XINE_LIBRARY})
+target_link_libraries(phonon_xine ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY} ${PHONON_LIBRARY} ${XINE_LIBRARY})
 if(XCB_FOUND AND XINE_XCB_FOUND)
     target_link_libraries(phonon_xine ${LIBXCB_LIBRARIES})
 endif(XCB_FOUND AND XINE_XCB_FOUND)


More information about the Kde-buildsystem mailing list