Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. adding a build step for CxxTest [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

adding a build step for CxxTest [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
qmakefeaturescxxtestbuild stepsextra compilers
2 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Karen Morrissey
    wrote on 21 Sept 2015, 16:01 last edited by Karen Morrissey
    #1

    I am new to qmake and am starting to set up a large project (~400 sub-projects). We use CxxTest as a unit test framework.

    Our convention is that there is a unit_test.h file for any unit test program to be built, that may include other unit_test*.h files. A main program, test_gen.cpp, is generated from the unit_test.h with a script cxxtestgen.pl.

    I've read the documentation, but I'm not sure I understand how to define the build step for generating the main program, and I don't understand how to make sure the main program object is dependent on all the unit_test*.h test files.

    Here's as much as I understand how to set up the build step (I'm making the main program be unit_test.cpp, same base name as the header file):

    cxxtest.output = ${QMAKE_FILE_BASE}.cpp
    cxxtest.commands = cxxtestgen.pl -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
    cxxtest = CXXTEST_HEADERS
    QMAKE_EXTRA_COMPILERS += cxxtest
    

    I was thinking of making this definition a cxxtest qmake feature. Can anyone tell me if I am close with the setup?

    I don't understand what to do to make sure the generated cpp is dependent on all the unit_test*.h files. Can anyone lend advice?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Karen Morrissey
      wrote on 22 Sept 2015, 22:39 last edited by Karen Morrissey
      #2

      I had problems with adding an extra compile step. It was easier to use an extra make target. What I came up with was a .pro file like the following:

      ### BEGIN setup for CxxTest test program
      TEMPLATE = app
      
      TARGET = test_runner
      
      cxxtest.target = test_runner.cpp
      cxxtest.commands = $$PWD/../../../third_party/cxxtest/cxxtestgen.pl \
        --error-printer --have-eh --have-std --abort-on-fail \
        -o test_runner.cpp $$PWD/unit_test.h
      cxxtest.depends = $$PWD/unit_test.h
      
      QMAKE_EXTRA_TARGETS += cxxtest
      
      HEADERS += unit_test*.h
      
      SOURCES += $$OUT_PWD/test_runner.cpp
      
      INCLUDEPATH += $$PWD/../../../third_party/cxxtest
      DEPENDPATH += $$PWD/../../../third_party/cxxtest
      ### END setup for CxxTest test program
      
      ### library dependencies, including for code under test, go here
      
      1 Reply Last reply
      0

      1/2

      21 Sept 2015, 16:01

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved