Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Add variable to project file in Qt creator

    Tools
    qt creator project config project files code coverage
    2
    3
    505
    Loading More Posts
    • 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.
    • V
      VictorTime last edited by

      Hello there, I want to generate code coverage report for my Qt project.
      Code coverage tool asks me to add a variable with arguments to my .pro file, however when I add those variable there seems to be no effect.
      I have a build log with code coverage executed from Codeblocks IDE-which shows where all arguments should go:

      -------------- Build: Debug in Genome (compiler: GNU GCC Compiler)---------------
      [ 50.0%] ctc32 -i m g++.exe -Wall -fexceptions -g -Weffc++ -Wextra -std=gnu++14 -Og -g -std=c++1z -IC:\Boost\include -c E:\Projects\Genome\src\main.cpp -o obj\Debug\main.o
      [100.0%] ctc32 -i m g++.exe  -o bin\Debug\Genome.exe obj\Debug\main.o
      ---------------------------------------------------------------------------------
      

      Here variable to add is: ctc32 and arguments are: -i m and they need to be executed before g++ is called.

      • I added variables to project file but I don't know how to pass it to qmake so that it can be called just before compiler is called?

      • I tried to edit Make files directly but they are auto generated each time project is build.

      Thank you

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        How exactly did you add that ?

        Not to nitpick but ctc32 is not a variable it's an executable or a script.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 1
        • V
          VictorTime last edited by

          Hello thanks for reply,
          Yes ctc32 is an executable and args -i m for instrumentation multi-condition code coverage.
          I added these lines to my project file.

          CodeCoverage {
           CTC32 += ctc32 -i m
          }
          
          QMAKE_CC  = CTC32$$QMAKE_CXX
          QMAKE_CXX = CTC32$$QMAKE_CXX
          

          I really don't understand how to tell Qt creator to call ctc32 before calling g++ (or in other words ctc32 will call g++). I had a look on qmake Variable Reference but this is the only thing I got.

          Thank you

          1 Reply Last reply Reply Quote 0
          • First post
            Last post