Wow thanks for the answers! I prefer Mikes' suggestion, since his way apparently doesn't make me change the sources ;-) It already works pretty good. I only have one little thing left:
Again a linker problem...: ==================== CMakeFiles/ToolBox.dir/main.o: In function `main': main.cpp:(.text+0x15): undefined reference to `qInitResources_application()' collect2: ld gab 1 als Ende-Status zurück make[2]: *** [src/ToolBox] Fehler 1 make[1]: *** [src/CMakeFiles/ToolBox.dir/all] Fehler 2 make: *** [all] Fehler 2 ==================== Any answers for that? @Mike: Just to clarify the comments in the CMakeLists.txt: # Set Non-Qt sources here SET (HEADERTOOL_SRCS # all cpp-files that don't include any QtClasse or have any Qt-Makros ) SET (HEADERTOOL_HEADERS # all h-files that don't include any QtClasse or have any Qt-Makros ) SET (HEADERTOOL_QT_SRCS # all cpp.files with Qt-Makros or -classes. ) SET( HEADERTOOL_QT_MOC_HDRS # all h. files with Qt-Markos or classes ) Thanks, junior Am Dienstag, den 11.09.2007, 07:45 -0400 schrieb Mike Jackson: > Have a look at my project located at: > > http://titanium.imts.us/viewvc/Task_4/ParadisTools/ > > This project has a few Qt related targets in it. The one to look at > would be: > > http://titanium.imts.us/viewvc/Task_4/ParadisTools/src/HeaderToolGui/ > > Look at the CMakeLists.txt file in there. It should have everything > you need to figure out how to port your project to CMake. > > Mike > -- > Mike Jackson Senior Research Engineer > Innovative Management & Technology Services > > > On Sep 11, 2007, at 4:12 AM, junior0007 wrote: > > > Hey Guys, > > > > I have a nice little project running (so far) under Kdevelop that > > contains some .ui-files. So far these ui-files are compiled using > > uic (i > > guess... - it's autom. done by Kdevelop...) so that the result is an > > ui_*.h file. This ui_*.h File is then included by the classes. > > > > So far i already found some nice help browsing this list and so i > > might > > be on the right way. However i still have linking-probs maybe you can > > help. > > > > The Project tree looks like: > >> project > >> bin > >> src > >> gui > >> gui_ui > >> model > > > > So far i just put a CMakeLists.txt into the project und project/src - > > directory and startet with trial-and error - lots of errors > > > > I already had a look at the list and found some things that should do > > the work, but how? > > > > Here is the src/CMakeLists.txt: > > > > =================================================================== > > PROJECT (TOOLBOX) > > > > SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules ) > > SET (VERSION 0.0.9) > > > > # requires QT4 in this Project > > find_package(Qt4 REQUIRED) # find and setup Qt4 for this project > > > > # Run Qt UIC on a UI file. > > # Arguments: > > # 1-N Names of .ui files > > MACRO(AIS_UI) > > FOREACH (it ${ARGN}) > > GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) > > # changed next line --added ui_ > > SET(outhfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) > > SET(outcppfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_uic.cpp) > > ADD_CUSTOM_COMMAND(OUTPUT ${outhfile} > > COMMAND ${QT_UIC_EXECUTABLE} ARGS -o ${outhfile} > > ${CMAKE_CURRENT_SOURCE_DIR}/${it} > > WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} > > MAIN_DEPENDENCY ${it} > > DEPENDS ${it} > > ) > > ADD_CUSTOM_COMMAND(OUTPUT ${outcppfile} > > COMMAND ${QT_UIC_EXECUTABLE} ARGS > > ${CMAKE_CURRENT_SOURCE_DIR}/${it} -impl ${outhfile} -o ${outcppfile} > > WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} > > MAIN_DEPENDENCY ${it} > > DEPENDS ${it} ${outhfile}) > > SET(CPP_SOURCE ${CPP_SOURCE} ${outcppfile}) > > AIS_MOC(${outhfile}) > > > > SET(AIS_UIC_SOURCES ${AIS_UIC_SOURCES} ${outcppfile}) > > LIST(APPEND AIS_UIC_HEADERS ${outhfile}) > > ENDFOREACH (it) > > ENDMACRO(AIS_UI) > > > > # Run Qt MOC on a C++ header file. > > # Arguments: > > # 1-N Names of headerfiles > > MACRO(AIS_MOC) > > FOREACH (it ${ARGN}) > > # Make .h filename absolute > > GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) > > > > # Build x_moc.cpp filename > > GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) > > SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_moc.cpp) > > > > # Run MOC > > ADD_CUSTOM_COMMAND(OUTPUT ${outfile} > > COMMAND ${QT_MOC_EXECUTABLE} > > ARGS ${infile} -o ${outfile} > > WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} > > DEPENDS ${infile} > > COMMENT MOCing ${it}) > > LIST(APPEND CPP_SOURCE ${outfile}) > > LIST(APPEND AIS_MOC_SOURCES ${outfile}) > > ENDFOREACH(it) > > ENDMACRO(AIS_MOC) > > > > > > # don't know for what but works ;-) > > include(${QT_USE_FILE}) > > include_directories(${CMAKE_CURRENT_BINARY_DIR}) > > > > # all QT_Designer Files > > SET(GUI_SRCS gui_ui/conprefswidget.ui [..] ) > > > > AIS_UI(${GUI_SRCS}) > > > > # all files that contain a Q_OBJECT REFERENCE > > SET (MOC_HDRS main.cpp [..] ) > > > > SET (HDRS Tools.h [..] ) > > SET (SRCS Tools.cpp [..] ) > > > > > > INCLUDE_DIRECTORIES( > > . > > ${QT_INCLUDE_DIR} > > ${QT_QT_INCLUDE_DIR} > > ${QT_QTGUI_INCLUDE_DIR} > > ) > > > > SET(EXECUTABLE_OUTPUT_PATH build/) > > > > ADD_EXECUTABLE(Toolbox ${SRCS} ${HDRS} ${UIC_HDRS} ${MOC_HDRS}) > > > > TARGET_LINK_LIBRARIES (Toolbox ${QT_LIBRARIES}) > > ====================================================================== > > = > > > > Works nice until linking... Linking causes: undefined reference to > > `vtable for [...] > > > > Can anybody help? > > > > > > Cheers > > junior > > > > > > > > _______________________________________________ > > CMake mailing list > > [email protected] > > http://www.cmake.org/mailman/listinfo/cmake > _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
