On Friday 09 March 2012 03:34:36 Darrell Anderson wrote: [...]
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} )
Nope, you can't insert a condition inside a function.
The correct way is this (in this case we are using pkgconfig information):
if( WITH_XEXT ) pkg_search_module( XEXT xext ) if( NOT XEXT_FOUND ) tde_message_fatal( "You requested Xext support, but is was not found on your system (or devel package is not installed' ) endif( ) check_include_file( "X11/extensions/shape.h" HAVE_X11_EXTENSIONS_SHAPE_H ) endif( )
tde_add_executable( ksnapshot AUTOMOC SOURCES ksnapshotiface.skel main.cpp ksnapshot.cpp regiongrabber.cpp windowgrabber.cpp ksnapshotwidget.ui LINK kdeprint-shared ${XEXT_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} )