Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Add variable to project file in Qt creator
QtWS25 Last Chance

Add variable to project file in Qt creator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qt creatorproject configproject filescode coverage
3 Posts 2 Posters 875 Views
  • 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 Offline
    V Offline
    VictorTime
    wrote on 1 Sept 2020, 18:08 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Sept 2020, 18:12 last edited by
      #2

      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
      1
      • V Offline
        V Offline
        VictorTime
        wrote on 1 Sept 2020, 18:38 last edited by
        #3

        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
        0

        3/3

        1 Sept 2020, 18:38

        • Login

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