trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Re: [trinity-devel] CMake - how to add library to build?

From: Darrell Anderson <humanreadable@...>
Date: Thu, 8 Mar 2012 17:34:36 -0800 (PST)
> > tde_add_executable( ksnapshot AUTOMOC
> >   SOURCES
> >     ksnapshotiface.skel main.cpp
> ksnapshot.cpp regiongrabber.cpp
> >     windowgrabber.cpp
> ksnapshotwidget.ui
> >   LINK kdeprint-shared Xext
> >   DESTINATION ${BIN_INSTALL_DIR}
> > )
> >
> > But this is dirty hack, because the build will fail if
> devel package of Xext is not installed.

Would a more proper solution be to test the value of the internal cmake variable HAVE_X11_EXTENSIONS_SHAPE_H and when true add the link? Something like this:

tde_add_executable( ksnapshot AUTOMOC
  SOURCES
    ksnapshotiface.skel main.cpp ksnapshot.cpp regiongrabber.cpp
    windowgrabber.cpp ksnapshotwidget.ui
    if( HAVE_X11_EXTENSIONS_SHAPE_H )
      LINK tdeprint-shared Xext
    else
      LINK tdeprint-shared
    endif( )
  DESTINATION ${BIN_INSTALL_DIR}
)

> > PS tde_add_library meaming that you add a target to
> Makefile, not to add a library to a target.
> 
>   That is what I needed to know. See -- you can teach
> an old dog cmake -- it just takes longer :)

Is ksnapshot supposed to link against Xext? I don't think so. When I look at my last tdegraphics build log, I see "-lXext" for kuickshow but no other tdegraphics components. The kuickshow CMakeLists.txt does not have a LINK directive for Xext but does have a LINK directive for IMLIB_LIBRARIES, through which kuickshow links to Xext. Looking at the older automake files does not show any ksnapshot linking to Xext or IMLIB_LIBRARIES.

Darrell