[CMake] cmake can't find qt4

Marcin Gil marcin.gil at gmail.com
Tue Feb 6 12:09:02 EST 2007


I'm learning to use cmake for qt4 programs.

in main directory CMakeLists.txt:
-=
PROJECT(dtmanager)

FIND_PACKAGE(QT4 REQUIRED)

ADD_SUBDIRECTORY(src)
=-

in src:

-=

INCLUDE(${QT_USE_FILE})

INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_BINARY_DIR}
	${QT_INCLUDE_DIR}
	${QT_QTNETWORK_INCLUDE_DIR}
)

SET(dtmanager_SRCS
	main.cpp
)

SET(dtmanager_UIS
	dtmanager.ui
	identities.ui
)

QT4_WRAP_UI(dtmanager_UIS_H ${dtmanager_UIS})

QT4_AUTOMOC(${dtmanager_SRCS})

ADD_EXECUTABLE(dtmanager ${dtmanager_SRCS} ${dtmanager_UIS_H})

TARGET_LINK_LIBRARIES(dtmanager ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARIES})
=-


I receive:

-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
CMake Error: QT4_DIR is not set.  It must be set to the directory containing 
QT4Config.cmake in order to use QT4.
-- Configuring done

And for sure I have qt 4.2.2 installed in /usr.
I am using cmake 2.4.6

What's wrong?
-Marcin


More information about the CMake mailing list