[CMake] how to use qt4_wrap_cpp
Tyler Roscoe
tyler at cryptio.net
Tue Feb 3 14:16:00 EST 2009
I just spent some time struggling with this macro so I wanted to post an
example. Maybe this can be used to expand on the documentation.
First you need to collect all the headers on which you want to run moc:
set (FOO_MOC_HEADERS foo_header.h)
Next, you pass these headers to the qt4_wrap_cpp macro. You *also* pass
a variable which will be populated with paths to the .cpp files
generated by moc:
qt4_wrap_cpp (FOO_MOC_OUTFILES ${FOO_MOC_HEADERS})
Finally, you include the generated .cpp files generated by moc with your
application/library:
add_library (foo SHARED ${FOO_SOURCE_FILES} ${FOO_MOC_OUTFILES})
The process is pretty simple, but deciphering that process was confusing
to me so I hope this simple example is helpful.
tyler
More information about the CMake
mailing list