Thank you all very much for your help. The problem is solved. I'd like to
post my CMakeLists.txt file here for other people with similar problems:
PROJECT ( COMBINED )
FIND_PACKAGE (Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
SET(QT_WRAP_CPP TRUE)
INCLUDE( ${QT_USE_FILE} )
SET(MOCHEADER glwidget.h window.h)
QT4_WRAP_CPP(MOCFILES ${MOCHEADER})
ADD_EXECUTABLE(exe main.cpp glwidget.cpp window.cpp ${MOCFILES})
TARGET_LINK_LIBRARIES(exe ${QT_LIBRARIES})
Linge
On Sat, Sep 27, 2008 at 11:11 AM, Bill Hoffman <[EMAIL PROTECTED]>wrote:
> Linge Bai wrote:
>
>> It is the moc stuff that's causing the problem. After used qmake to
>> generate moc_*.cpp files, I was able to use cmake to compile the code. But I
>> still have no idea on how to use cmake to compile the code without using
>> qmake to generate the moc files first.
>>
>> The change to my CMakeLists.txt file I made is:
>> SET(QT_WRAP_CPP TRUE)
>>
>> See here:
> http://www.cmake.org/cmake/help/cmake2.6docs.html#module:FindQt4
>
> Specifically:
>
> There are also some files that need processing by some Qt tools such as moc
> and uic. Listed below are macros that may be used to process those files.
>
>
> macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...)
> create moc code from a list of files containing Qt class with
> the Q_OBJECT declaration. Per-direcotry preprocessor definitions
> are also added. Options may be given to moc, such as those found
> when executing "moc -help".
>
> -Bill
>
> --
> Bill Hoffman
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> [EMAIL PROTECTED]
> http://www.kitware.com
> 518-371-3971 (phone and fax)
>
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake