[CMake] cmake qt4 Lplates

Andreas Pakulat apaku at gmx.de
Fri Dec 10 16:17:21 EST 2010


On 10.12.10 22:09:29, luxInteg wrote:
> Greetings,
> 
> I   have my cmake L-plates firmly on ( with a Qt4  project I am stumbling on )
> 
> I have these in   CMakeLists.txt file:-
>  FIND_PACKAGE( Qt4 REQUIRED )
>   INCLUDE( ${QT_USE_FILE} )
>   set(QT_USE_OPENGL TRUE)
>   set(QT_USE_QTSVG  TRUE )
>   SET( QT_USE_QTXML TRUE )
>   SET( QT_USE_QT3SUPPORT TRUE )
>   SET( QT_USE_QTNETWORK  TRUE )
>   SET( QT_USE_QTASSISTANT TRUE )
>   SET(QT_USE_QTSCRIPT TRUE)

This is wrong, you should set the use-variables _before_ including
the use-file. Otherwise the qt-include-dir-variable as well as libraries
variable won't contain these modules. Thats the whole point of the
use-module.

> include_directories( ${CMAKE_BINARY_DIR} ${QT_INCLUDE_DIR} )

This should work, but with the wrong order above it might only set
includes for Qt/, QtCore/ and QtGui/ subdirs.

> Two sets pf problems I have encountered include:'
> 
> A:- I cannot set   the includes for Qt4  as 'found' by FindQt4.cmake.  I 
> looked through  the said file for such a variable  under mark_as_advanced()  
> or somesuch but I could not discern any  related functions nor  variable 
> names.  I tried  ${QT_INCLUDE_DIR}, ${QT_HEADERS_DIR} aand ${QT_INCLUDES} to 
> no avail.    I had to resort to  setting these manually as 
> /opt/qt4/include/XXXX

Did you print out QT_INCLUDE_DIR to check its value or QT_INCLUDES?

> B:- This might be due to the manual setting of   the Qt4_INCLUDE 
> (directory(s), but I seem to get duplication in the preprocessors    
> (generated automatically):   Below is an example
> 
> -DQT_NO_DEBUG 
> -DQT_SVG_LIB 
> -DQT_QT3SUPPORT_LIB 
> -DQT3_SUPPORT 
> -DQT_XML_LIB 
> -DQT_OPENGL_LIB 
> -DQT_GUI_LIB 
> -DQT_NETWORK_LIB 
> -DQT_CORE_LIB 
> -DQT_SHARED 
> -DQT_NO_DEBUG 
> -DQT_GUI_LIB 
> -DQT_CORE_LIB 
> -DQT_SHARED
> 
> (REMARK I have  -DQT_SHARED   -DQT_NO_DEBUG   both duplicated) 

Whats the problem with that? And are you setting the defines yourself to
be included (via QT_DEFINITIONS) or is that done by the use-module?

Andreas

-- 
Are you sure the back door is locked?


More information about the CMake mailing list