[CMake] cmake qt4 opengl

luxInteg lux-integ at btconnect.com
Mon Dec 13 07:48:23 EST 2010


Greetings,

This is towards banishing  my  cmake/qt4 idiocy.


my CMakeLists.txt has these:-


  FIND_PACKAGE( Qt4 REQUIRED )

  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_QTASSISTANTCLIENT  TRUE)
  set(QT_USE_QTTEST TRUE )
  set( QT_USE_QTMAIN TRUE)

INCLUDE( ${QT_USE_FILE} )
include_directories(${QT_INCLUDE_DIR})

 ADD_DEFINITIONS( -Wall )
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS( -D_REENTRANT  )
ADD_DEFINITIONS(-DQT_NO_DEBUG )
ADD_DEFINITIONS(-DQT_SHARED )



I get preprocessors such s these:-

-DQT3_SUPPORT 
-DQT_3SUPPORT_LIB 
-DQT_ASSISTANT_LIB 
-DQT_SCRIPT_LIB 
-DQT_SVG_LIB 
-DQT_GUI_LIB 
-DQT_TEST_LIB 
-DQT_XML_LIB 
-DQT_NETWORK_LIB 
-DQT_CORE_LIB 
-D_REENTRANT 
-DQT_NO_DEBUG 
-DQT_SHARED 

and  includes such as 
-I/opt/qt4/include/Qt3Support  etc but no 
-I/opt/qt4/include/Qt4OpenGL 

even if I add   these 

 FIND_PACKAGE( X11 REQUIRED )
 FIND_PACKAGE( OpenGL REQUIRED )

*with cmake responding as follows:-
--------------
-- Looking for XOpenDisplay in 
/usr/X11R6/lib64/libX11.so;/usr/X11R6/lib64/libXext.so
-- Looking for XOpenDisplay in 
/usr/X11R6/lib64/libX11.so;/usr/X11R6/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/X11R6/lib64/libX11.so
found opengl
-------------

I even added ${OPENGL_INCLUDE_DIR}  to include_directories()  but it  made no 
difference

QUESTIONS:-

---a) Is it necessary to manually   set  ADD_DEFINITIONS( -DQT_OPENGL_LIB  )  
and   add /opt/qt4/include/Qt4OpenGL to include_directories() ?
---b) this file  qplatformdefs.h   
http://qt.gitorious.org/qt/qt/blobs/15f52e00e50784d39bd2ffe8a2924aecbc0ce2cc/mkspecs/unsupported/linux-
clang/qplatformdefs.h
OR
http://www.koders.com/cpp/fid5FE3743846336C984EFBA55350C74C26F8BFB714.aspx

  is  part of qt4 (its in the mkspecs  directory);  Is it necessary to include 
it in a cmake/qt4 project and if so how so?

sincerely
luxInteg


More information about the CMake mailing list