Thank you all for your replies, however I would prefer using Qt functions rather than kde4_add_unit_test. I finally got it to work, but I had to split the test class in .h and .cpp files, and call qt_wrap_cpp on header file, including mocs in sources when I call add_executable. Another question: it's not a big problem, just for my knowledge. I had to create a static library from my project source and link the test executable against it, otherwise it gives some "undefined reference to". Is there a way to get it without creating a library and link it? Thank you very much!
2011/1/28 Milian Wolff <m...@milianw.de> > On 01/28/11 08:59, Andreas Pakulat wrote: > > On 27.01.11 23:14:59, Valentin Rusu wrote: > >> On 01/27/2011 10:56 PM, Riccardo Bellini wrote: > >>> Hello! > >>> I wonder if there is a way to set up and run in CMake one or more test > >>> like those created with Qt Unit Test library. > >> Yes, there is a way :) > >>> I need to know in particular what commands do I have to use, just a > >>> simple example of how to create a test executable from a test class. > >> Here is the structure of the CMakeLists.txt shown between === lines > >> ================ > >> SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) > >> > >> INCLUDE_DIRECTORIES ( > >> ${KDE4_INCLUDES} > >> ${CMAKE_SOURCE_DIR} > >> ${CMAKE_CURRENT_BINARY_DIR} > >> ) > >> > >> KDE4_ADD_EXECUTABLE (riccardo_test > >> testclass.cpp > >> ) > >> > >> TARGET_LINK_LIBRARIES (riccardo_test > >> ${QT_QTTEST_LIBRARIES} > >> ) > >> > >> ADD_TEST (TestClass riccardo_test) > > > > If you're already using KDE stuff, then you don't need this. There's a > > special macro for unit-tests: > > kde4_add_unit_test taking a target name and the sources list. > > ++ use that macro, it's very handy. > > And don't forget that you can call ctest afterwards in your build dir to > execute all test suites, also very good to take a look at whether you > introduced regressions. > > bye > > -- > Milian Wolff > http://milianw.de > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to > unsubscribe << >
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<