[CMake] A little patch for FindQt4.cmake
Fu Limin
limin.fu at ircc.it
Tue Aug 8 09:01:26 EDT 2006
Hi,
I have writen a little patch for FindQt4.cmake. The patch simply do one
thing, it read library linking flags from *.prl file under QTDIR/lib.
The reason that I create this patch is that, FindQt4 do not set all the
linking flags (e.g. -lXinerama etc.) required by qt application. I hope
this patch can be useful for somebody. The linking flags found in *.prl
files are stored in QT_LIBRARIES, maybe the script should be modified to
store them in separated variables, for example, flags from libQtCore.prl
should be stored in QT_QTCORE_LIBRARY etc.
cheers,
Limin
*587a588,618*
> SET(QT_LIBRARIES "")
> # This macro reads linking flags from .prl file, and add them to QT_LIBRARIES.
> # It will do nothing, if the file do not exist.
> MACRO( QT_LINK_FLAGS_FROM_PRL FILENAME )
>
> SET( FILE_PRL "NOTFOUND" )
> FIND_FILE( FILE_PRL ${FILENAME} $ENV{QTDIR}/lib )
>
> IF( FILE_PRL )
>
> # Read .prl file:
> FILE( READ ${FILE_PRL} LIB_QTGUI_PRL )
>
> # Extract the line with linking flags:
> STRING( REGEX MATCH "QMAKE_PRL_LIBS.+" PRL_LINE ${LIB_QTGUI_PRL} )
>
> # Split the line by whitespaces:
> STRING( REGEX MATCHALL "[^ \t\n]+" PRL_LINK_FLAGS ${PRL_LINE} )
>
> # Remove items which are not linking flags:
> LIST( REMOVE_ITEM PRL_LINK_FLAGS "QMAKE_PRL_LIBS" "=" )
>
> # Remove flags from QT_LIBRARIES, if they are presented in PRL_LINK_FLAGS:
> LIST( REMOVE_ITEM QT_LIBRARIES ${PRL_LINK_FLAGS})
>
> # Add flags from PRL_LINK_FLAGS to QT_LIBRARIES:
> LIST( APPEND QT_LIBRARIES ${PRL_LINK_FLAGS} )
>
> ENDIF( FILE_PRL )
>
> ENDMACRO( QT_LINK_FLAGS_FROM_PRL )
*605a637,663*
> QT_LINK_FLAGS_FROM_PRL( libQtCore.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtCore_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtGui.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtGui_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQt3Support.prl )
> QT_LINK_FLAGS_FROM_PRL( libQt3Support_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtAssistantClient.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtAssistantClient_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtDesigner.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtDesigner_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtDesignerComponents.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtDesignerComponents_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtMain.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtMain_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtMotif.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtMotif_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtNetwork.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtNetwork_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtNsplugin.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtNsplugin_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtOpenGL.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtOpenGL_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtSql.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtSql_debug.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtXml.prl )
> QT_LINK_FLAGS_FROM_PRL( libQtXml_debug.prl )
>
More information about the CMake
mailing list