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 <<