kdelib CMakeFile should check if X11/SM/SMlib.h is available

Alexander Neundorf neundorf at kde.org
Tue May 20 21:56:28 CEST 2008


On Tuesday 20 May 2008, Allen Winter wrote:
> On Tuesday 20 May 2008 05:34:59 Esben Mose Hansen wrote:
> > Hi,
> >
> > debian unstable ships said headerfile in libsm-dev, so it might be a good
> > idea to check for the header file explicitly in configure, instead of
> > having the compile fail with a missing include inside.
>
> We currently don't complain about all the various sub-packages
> and extensions within X that might cause build problems.
> We look for many (see kdelibs/cmake/modules/FindX11.cmake)
> but we don't complain if they aren't there.
>
> I suppose SM and ICE are important enough that we could put something like:
> if(NOT X11_ICE_FOUND)
>  message(FATAL_ERROR "install ICE")
> endif(NOT X11_ICE_FOUND)
> ditto for SM.
>
> Should I do this?

I don't know, I would say no.
When searching for X11, you do:
1) find_package(X11)
or 
2) find_package(X11 REQUIRED)

In the first case it must not fail with FATAL_ERROR if something is not found.
In the second case it must fail if X11 is not found (check via 
X11_FIND_REQUIRED).
Now the question is, if I say X11 is required, but ICE is not found, does this 
mean X11 is not found ?
I would say no.
Probably many users can still use X11 even if ICE has not been found and would 
be unhappy if it fails for them.
So I'd say the following code should be in the CMakeLists.txt, not in 
FindX11.cmake:

find_package(X11 REQUIRED)
if(NOT X11_ICE_FOUND)
  message(FATAL_ERROR "install ICE")
endif(NOT X11_ICE_FOUND)

Alex


More information about the Kde-buildsystem mailing list