[CMake] cmake qt4 for dummies

David Cole david.cole at kitware.com
Wed Nov 24 12:11:52 EST 2010


On Wed, Nov 24, 2010 at 1:09 PM, luxInteg <lux-integ at btconnect.com> wrote:
> On Wednesday 24 November 2010 16:33:24 David Cole wrote:
>> The example that demonstrates how to use BundleUtilities contains a Qt
>> app. See the CMakeLists file in that project for clues about how to
>> structure a Qt application.
>>
>> See also CMake itself, in the CMake/Source/QtDialog. And ParaView, too
>> -- it's a Qt app.
>>
>> Start with the example, though, it's much simpler than either CMake or
>> ParaView.
>>
>>
> Thanks  but my interest is   how to port from qmake to   cmake. The example I
> gave was a simple project with two files  with one file being transformed
> into another prepended by 'moc' via qmake  (Please see below):-
>
> -------------------------------------------
>  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.
>
> I merely wnat to know how to generate    moc/moc_file2.cpp
>
> I.E   whether:-
>
>  a)  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) OR  it done otherwise and if so how so?
> --------------------------------------------------
>


I am not a Qt expert. But to the best of my knowledge, dealing with
the moc, ui and qrc files and such is best handled by the QT4_* macros
as demonstrated ****in the example that I already pointed you to*****.

Please read the CMakeLists.txt file from the example before asking
more questions.

The simple bundle utilities example is a bare-bones Qt app on purpose
so that it is easily understood.

If it is not obvious how to proceed after that, then by all means, ask
for clarification.


Peace out, dog...


More information about the CMake mailing list