Hi,
On 22 Oct 2009, at 11:15, Murray Cumming wrote:
I'm trying to use CMake for the first time, as an experiment, with
little a Qt-based project. It also uses an additional library, via
pkg-config.
So far Qt's include files don't seem to be found, and I wonder how I
can
cause moc to be used to generate some of the .cc files.
Here's what I have so far:
http://github.com/murraycu/qlom/blob/qlom_cmake/CMakeLists.txt
based on the many and varied google results.
I've found CMake to work well with Qt4, but it does need a few more
things set in your CMakeLists.txt. With CMake in general I have found
that I have to load the FindXxx.cmake files into my editor to see what
things are supported.
This is what I have in a project that also requires Qt3 support:
# find Qt4
find_package(Qt4 REQUIRED)
set(QT_USE_QT3SUPPORT 1)
set(QT_USE_QTXML 1)
include(${QT_USE_FILE})
So, set the options you need, then include the Qt Use file. The
options are listed in FindQt4.cmake.
Then to do the moc'ing and build the app:
List your include files to be moc'ed in e.g. MY_INC_FILES and your cpp
source code in e.g. MY_SRC_FILES...
qt4_wrap_cpp(MY_MOC_FILES ${MY_INC_FILES})
add_executable(my_app ${MY_SRC_FILES} ${MY_MOC_FILES})
target_link_libraries(my_app ${QT_LIBRARIES})
So the moc'ed files get passed into add_executable in the normal way!
Cheers,
Rob
_______________________________________________
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