[CMake] cmake qt4 for dummies

David Doria daviddoria at gmail.com
Wed Nov 24 11:37:11 EST 2010


> On Wed, Nov 24, 2010 at 12:25 PM, luxInteg <lux-integ at btconnect.com> wrote:
>> 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
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

Here are some simple Qt examples with CMakeLists.txt files:
http://programmingexamples.net/index.php?title=Qt

And some examples that also use VTK:
http://www.vtk.org/Wiki/VTK/Examples/Cxx#Qt

David


More information about the CMake mailing list