[CMake] cmake qt4 for dummies

luxInteg lux-integ at btconnect.com
Wed Nov 24 12:25:00 EST 2010


Greetings,

I am learning cmake.  I am  now  having a go at learning   to   compile a qt4 
project wuth cmake.  I am  starting with  qt-4.6.2  and  I want to play with 
compiling a small project  into a  library.   


From what I can discern most things  seem straightforward but some   files 
seemd to need  transforming  by the  so called MOC:-
 
Lets say I have a  project that uses qmake  with the following files 
../src/file1.cpp 
../src/file2.cpp   

 to compile into   some library  libTESTcpp.a.  After running qmake   and make 
the build-log reveals:-
compiled file1.cpp
cpmpiled file2.cpp
compiled moc/moc_file2.cpp

then
archived *.o  ino libTESTcpp.a.

SO when porting the setup to cmake:-
a) Can  the  transformation for file2.cpp  to moc/moc_file2.cpp be  manually 
done  as per:- 
configure_file(../src/file2.cpp ../src/moc/moc_file2.cpp @COPYONLY)  ?  OR

b) Is it done otherwise and if so how so?

The cmake qt4 examples I managed to find on the internet  eg
(  
http://developer.qt.nokia.com/quarterly/view/using_cmake_to_build_qt_projects            
)  
tend to be  for executable files the most useful one (linked above)  mentioned   
moc-headers, ui-files  qrc  files  none of which are present in this project.


Advice would be appreciated.

luxInteg


More information about the CMake mailing list