[CMake] find_package(Qt4 REQUIRED) doesn't include QtNetwork?

kent williams nkwmailinglists at gmail.com
Fri Mar 4 13:59:07 EST 2011


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.

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)

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?
Did something change in recent CMake versions?


More information about the CMake mailing list