[CMake] cmake failing to find QApplication header

Stephen Collyer scollyer at netspinner.co.uk
Fri Nov 16 14:37:30 EST 2007


I have a top level CMakeList.txt file containing:

FIND_PACKAGE(Qt4 REQUIRED)
.
.
INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${QT_QTGUI_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${QT_QTNETWORK_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR})

and I've tried to build the Hello World example from the
Qt tutorial which looks like this:

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPushButton hello("Hello world!");
    hello.resize(100, 30);

    hello.show();
    return app.exec();
}

and "make all" complains with errors of this nature:

<somedire>/src/exe/qt_test.cpp:1:24: error: QApplication: No such file
or directory

which seems to indicate some failure of the -I generation.
I can't think what else I need to do though. The various
${QT_.._INCLUDE_DIR} variables seems to be correctly defined.

Any hints ?

-- 
Regards

Steve Collyer
Netspinner Ltd


More information about the CMake mailing list