Alexander Neundorf neundorf at
Fri Mar 11 17:28:48 GMT 2011

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 Macro invoked with incorrect arguments for macro named:
> 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.

> 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:


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 ?

Second, it makes no sense for package Foo to install a FindFoo.cmake for 
So, don't install FindPhonon.cmake.

Sorry, FindPhonon.cmake itself looks bad, delete it and start from scratch:

    find_program(PC_EXECUTABLE NAMES pkg-config
    PATH_SUFFIXES bin               

There is a FindPkgConfig.cmake, why don't you use that ?

Beside, Phonon itself uses cmake, so install a cmake Config.cmake file. This 
file can contain all the information about the installed phonon you want.
There is absolutely no need for *requiring* pkg-config.
Especially not in a FindPhonon.cmake which is only found if the "searching" 
project already knows where Phonon is.



    if (Phonon_FIND_REQUIRED)
        set(_req REQUIRED)
    endif (Phonon_FIND_REQUIRED)
        set(_quiet QUIET)

    find_package(PhononInternal ${_req} ${_quiet})
    if (_data_DIR)
        if (Phonon_FIND_REQUIRED)
            message(FATAL_ERROR "ERROR: FindPhonon.cmake not found in 
        endif (Phonon_FIND_REQUIRED)
    else (_data_DIR)
        if (Phonon_FIND_REQUIRED)
            message(FATAL_ERROR "ERROR: Either pkg-config can not find its 
phonon config, or you are not using a recent enough Phonon version.")
        endif (Phonon_FIND_REQUIRED)
    endif (_data_DIR)

There is the macro find_package_handle_standard_args().
Use that and remove all the code above.

If you have question about how to do things properly with cmake, don't 
hesitate to ask on kde-buildsystem at or cmake at
This would be much better than spreading such code.


More information about the kde-multimedia mailing list