Hi,everyone
I am new to cmake. I don't know how to write a CMakeList.txt file if
Q_OBJECT in a "xxx.cpp" source file.
for example,
A very simple qt4 program like this.
// filename main.cpp
#include <QtGui/QApplication>
#include <QtGui/QWidget>
class Widget:public QWidget
{
Q_OBJECT
public:
Widget(QWidget * parent=0):QWidget(parent) {}
};
#include "main.moc"
int main(int argc, char** argv) {
QApplication app(argc, argv);
Widget w;
w.show();
return app.exec();
}
if i use qmake, i only needed a simple .pro file like this:
TEMPLATE = app
SOURCES += main.cpp
I try to write a CMakeList.txt, try qt4_wrap_cpp qt4_automoc and
qt4_generate_moc, but They did not seem to work
PROJECT(mytest)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED)
INCLUDE(${QT_USE_FILE})
SET(pro_SOURCES main.cpp)
#QT4_WRAP_CPP(${pro_SOURCES})
#QT4_AUTOMOC(${pro_SOURCES})
#QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_BINARY_DIR}/main.moc)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_EXECUTABLE(mytest ${pro_SOURCES})
TARGET_LINK_LIBRARIES(mytest ${QT_LIBRARIES})
Is there any solution to this?
thanks
_______________________________________________
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