[CMake] Use Qt Libarys in cmake

Manuel Schmidt manuel at schmidtman.de
Sat May 5 18:17:20 EDT 2007


Hello List,
i m just trying cmake to build a small project. I m using Xml Stuff in it, so 
my *.pro file had something like  'QT += xml'. 
So far i think my CMakeLists.txt is right but the Xml lib is missing. CMake 
succeeds but make fails claiming that QDomDocument is not declared.

My CMakeLists.txt is obviously wrong, but what would be the correct way to 
incude the non default Qt Libs ?

here is my CMakeLists.txt:


project( ModelView )
find_package(Qt4 REQUIRED)

set( QT_USE_XML TRUE)
include( ${QT_USE_FILE} )

INCLUDE_DIRECTORIES(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${QT_INCLUDE_DIR}
)

set( modelview_SRCS
    main.cpp
    mainwindow.cpp
    addressbook.cpp
)

set( modelview_MOC_H
    mainwindow.h
    addressbook.h
)

qt4_wrap_cpp( modelview_MOC_SRCS ${modelview_MOC_H} )

add_executable( modelview ${modelview_SRCS} ${modelview_MOC_SRCS} )

TARGET_LINK_LIBRARIES(
    modelview ${QT_LIBRARIES}
)


thank you 

-- 
Cheers 
Manuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070506/2e7c81f9/attachment.pgp


More information about the CMake mailing list