Handling Missing X Libs Better
Allen Winter
winter at kde.org
Tue Feb 27 21:56:35 CET 2007
On Tuesday 27 February 2007 3:42:22 pm Alexander Neundorf wrote:
> On Tuesday 27 February 2007 19:20, Allen Winter wrote:
> > Howdy,
> >
> > Here's a problem with the buildsystem that I hope a cmake guru can fix.
> > A least twice I've had to help people on $kde4-devel with the following
> > scenario:
> >
> > - user runs cmake && make
> > - compile fails due to missing ICE include files
> > - user installs their distros libICE-devel packages
> > - user runs cmake && make
> > - linking fails (can't find libICE)
> >
> > apparently the fact that libICE can't be found is cached.
> > so the user needs to remove their cmake cache so the
> > search for libICE is re-run and then added to the linker libs list.
> >
> > Should there be an error exit from cmake if libICE can't be found
> > in the first place?
>
> Where does this happen ?
>
Alex,
You're forcing me to not be lazy :)
OK, in FindX11.cmake we see
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
if (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
set(X11_X_PRE_LIBS -lSM -lICE)
endif (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
If not found, then you'll have in CMakeCache.txt:
MAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER:INTERNAL=0
and cmake continues normally.
then the compile starts and errors when you encounter a file that
looks for an ICE include file.
then you realize you need the libICE devel package, so you install it.
then you run cmake again, but CHECK_LIBRARY_EXISTS("ICE".... ) apparently
looks at the cache value of CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER
so you'll never have "-lSM -lICE" added to your X11_LIBS
i'm proposing we change the logic to:
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
if (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
set(X11_X_PRE_LIBS -lSM -lICE)
else
macro_log_feature(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER "libICE" ... etc. etc)
endif (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
either that, or do something to ensure CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER
isn't cached.
--
KDEPIM Developer
I accept PayPal payments to awinterz at earthlink.net
More information about the Kde-buildsystem
mailing list