Phonon

Alexander Neundorf neundorf at kde.org
Sat Mar 12 21:11:21 CET 2011


On Saturday 12 March 2011, Trever Fischer wrote:
> > Hi all,
> >
> > On Thursday 10 March 2011, Ben Cooksley wrote:
> >> Hi all,
> >>
> >> I have found recently that I cannot build KDE Runtime. In tracing
> >> this, I ended up with an obscure error:
> >>
> >> CMake Error at
> >> /opt/trunk-kde/kde/share/apps/cmake/modules/MacroEnsureVersion.cmake:95
> >> (NORMALIZE_VERSION):
> >>   NORMALIZE_VERSION Macro invoked with incorrect arguments for macro
> >> named:
> >>   NORMALIZE_VERSION
> >> Call Stack (most recent call first):
> >>   phonon/CMakeLists.txt:18 (macro_ensure_version)
> >
> > When calling normalize_version(), the version variable should be put in
> > quotes, this way even if it is empty it at least becomes an empty string
> > instead of nothing.
> >
> > NORMALIZE_VERSION( "${found_version}" found_vers_num )
> >
> >> This error message actually means that PHONON_VERSION is empty.
> >> Further diagnosing this, I noticed that Phonon recently made changes
> >> to where they stored the version string, yet they updated their CMake
> >> files.
> >>
> >> Digging further, I discovered that CMake wasn't using the new ones,
> >> because they are being installed to $prefix/share/phonon-buildsystem/
> >
> > That's not a good idea. Don't do that. Or only do it if you are really
> > sure
> > you know what you are doing.
>
> phonon-buildsystem is only used to build the backends. Applications should
> *not* be using the stuff in there. If they manage to find FindPhonon.cmake
> from phonon-buildsystem, the application's build has a bug. Our
> FindPhonon.cmake looks for FindPhononInternal.cmake, which adds some build
> magic for the backends, such as telling them we have pulseaudio support,
> where to install the backend library, and some standard compilation flags
> across all backends.

FindKDE4Internal.cmake was done in cmake 2.4.0 times.
Since cmake 2.6.0 cmake supports finding XXXConfig.cmake files, installed in 
lib/cmake/XXX/. 
So you could install a PhononConfig.cmake file, which contains all the 
information you want. This file will be found directly by cmake, and it will 
be "cmake-conform", no messing around with pkg-config.
I would strongly recommend to do this.

The pages here: http://www.vtk.org/Wiki/CMake/Tutorials explain how to do 
this.

>
> >> instead of the standard location ( $prefix/share/apps/cmake )
> >
> > Although kdelibs install both cmake find-modules as well as it's own
> > cmake info-files there, it is not a standard location in any way. For
> > KDE5 this will be different.
> >
> >
> > I just had a look at cmake/CMakeLists.txt in phonons git.
> >
> > Now this does not look good:
> >
> > set(BUILDSYSTEM_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/phonon-buildsystem/)
> > install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in
> >               ${CMAKE_CURRENT_SOURCE_DIR}/FindAutomoc4.cmake
> >              
> > ${CMAKE_CURRENT_SOURCE_DIR}/FindPackageHandleStandardArgs.cmake
> > ${CMAKE_CURRENT_SOURCE_DIR}/FindPhonon.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/FindPhononInternal.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/PhononMacros.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/FindQt4.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/MacroEnsureVersion.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/MacroLogFeature.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/MacroOptionalFindPackage.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/MacroPushRequiredVars.cmake
> >               ${CMAKE_CURRENT_SOURCE_DIR}/PhononMacros.cmake
> >         DESTINATION ${BUILDSYSTEM_INSTALL_DIR})
> >
> >
> > Why do you think that Phonon needs to install that many Find-modules ?
> >
> > This means you have to take care of keeping compatibility for them !
> > (it's not often that I use the exclamation mark).
> > Who is your cmake guy who does that ?
>
> Harald handles most of the cmake stuff. We only install all those because
> only the building of the phonon backends need them. There is no urgent
> need to keep compatability with them since there is a total of 5
> consumers, all of which we keep eyes on.

But is it necessary to install an own copy of FindQt4 ?
Also e.g. I would strongly recommend against installing any other cmake files. 
This will only lead to compatibility problems.

Alex


More information about the Kde-buildsystem mailing list