Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Moved]QMake: Adding target to start unit tests



  • Hi,

    I want to add a target to my QMake unit test project file to execute the unit test that was built.

    In the makefile i would use the following targets:

    @
    all: $(TARGET)

    test: $(TARGET)
    @rm -f $(OBJDIR)/*.gcda
    @LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(subst $(SPACE),:,$(LDDIRS)) && ./$(TARGET)

    coverage: test
    @for i in cd ../main && ls *.cpp *.h && cd -; do echo $$i; gcov -o build $$i | grep -m1 "%"; done
    @

    (How) can this be done using QMake project files to generate a makefile like above?

    [EDIT: code formatting, Volker]



  • One possibility would be "QMAKE_EXTRA_TARGETS":http://doc.qt.nokia.com/latest/qmake-environment-reference.html#customizing.


Log in to reply