FindPlasma.cmake not ok

Alexander Neundorf neundorf at kde.org
Thu Nov 6 00:46:47 CET 2008


Hi,

FindPlasma.cmake as it is currently in kdelibs doesn't make sense.
Each cmake module should (or must) be self-contained, i.e. you should be able 
to do simply

find_package(Foo)

and you should get the expected results.
Now FindPlasma.cmake is right now only this:

--------8<-------------8<--------------------8<-----------
set(PLASMA_LIBS ${KDE4_PLASMA_LIBS} )
set(PLASMA_INCLUDE_DIR ${KDE4_INCLUDE_DIR})
set(PLASMA_FOUND true)

find_file(PLASMA_OPENGL_FOUND plasma/glapplet.h
          PATHS ${PLASMA_INCLUDE_DIR}
          NO_DEFAULT_PATH)

mark_as_advanced(PLASMA_INCLUDE_DIR PLASMA_LIBS)
--------8<-------------8<--------------------8<-----------


If I just do 
find_package(Plasma)

I will PLASMA_FOUND TRUE as result, which would be clearly wrong (i.e. 
PLASMA_LIBS and PLASMA_INCLUDE_DIR would be empty).

What would in some way work would be:

find_package(KDE4)
find_package(Plasma)

Still PLASMA_FOUND would always be true then, also if KDE4 was *not* found.

So, this needs to be fixed.
How ?
Does a separate FindPlasma.cmake still make sense ?
It's probably good to keep it for compatibility.
The minimum would be to add something like this:

if(NOT DEFINED KDE4_FOUND)
   find_package(KDE4)
endif(NOT DEFINED KDE4_FOUND)

...
set(PLASMA_FOUND ${KDE4_FOUND})
...

This would make it self-contained and also report correct results.

Somewhat harder would be to make it empty except a message like
message(FATAL_ERROR "FindPlasma.cmake doesn't exist anymore, please use this
                     and that instead")

This would be cleaner but not be backward compatible. But OTOH, Plasma will 
just start staying compatible with the 4.2 release, right ?
So anything relying on it since 4.1 may be broken anyway ?

Alex




More information about the Kde-buildsystem mailing list