On Friday, March 04, 2011 11:59:07 am kent williams wrote:
> To use Qt in my projects with CMake, up until now all it seemed to
> require was this:
> 
> find_package(Qt4 REQUIRED)
> include(${QT_USE_FILE})
> 
> But then I tried to use QTcpServer and QTcpSocket, and the compiles
> failed because it couldn't find the include files.

Were you doing this: #include <QtNetwork/...>,
or setting QT_USE_QTNETWORK=1 somehow before include(${QT_USE_FILE}),
or your own include_directories() somewhere?

> 
> Then I read through the FindQt4.cmake file that comes with CMake
> 2.8.4, and found that I could fix the problem with
> 
> find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)

find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) will set QT_USE_QTNETWORK=1 
for you.

> 
> But I'm confused that all my programs I built before I tried to use
> networking had worked.  I thought the first, simpler find_package
> statement would just include everything by default.  Is that wrong?

The simpler find_package() defaults to QtCore and QtGui modules being enabled.  
It has always been that way.

Clint
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to