[CMake] cmake failing to find QApplication header

clinton at elemtech.com clinton at elemtech.com
Fri Nov 16 18:36:24 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})


Its easier to do this
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTSQL TRUE)
INCLUDE(${QT_USE_FILE})

So the 'use' file will set up the preprocessor defines and set up what 
libraries to link with.
Like this:
TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})

If that doesn't fix your problem, perhaps you should check your CMakeCache.txt 
file to make sure it has the right path for the QT*INCLUDE_DIR variables.

Clint


More information about the CMake mailing list