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. Adding a custom build target to QtCreator
Forum Updated to NodeBB v4.3 + New Features

Adding a custom build target to QtCreator

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
2 Posts 1 Posters 2.0k 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.
  • G Offline
    G Offline
    GregWilsonLindberg
    wrote on last edited by
    #1

    I'm using QtCreator 3.2.1, based on Qt 5.3.2, running on a Rpi3.
    I'm trying to add a custom build target to create a .c & .h file that will be compiled in and linked to my application.
    Qmake Advanced Usage gives instructions on how to add a custom target and I've followed them:

    makeObjDict.target   = ObjDict.c
    makeObjDict.commands = python ~/CanFestival/canfestival-3-asc/objdictgen/objdictgen.py ObjDict.od ObjDict.c
    makeObjDict.depends  = ObjDict.od
    
    QMAKE_EXTRA_TARGETS += makeObjDict
    PRE_TARGETDEPS      += makeObjDict
    

    But all I get is an error:
    No rule to make target 'makeObjDict'

    Does anyone have an idea what I'm doing wrong?

    G 1 Reply Last reply
    0
    • G GregWilsonLindberg

      I'm using QtCreator 3.2.1, based on Qt 5.3.2, running on a Rpi3.
      I'm trying to add a custom build target to create a .c & .h file that will be compiled in and linked to my application.
      Qmake Advanced Usage gives instructions on how to add a custom target and I've followed them:

      makeObjDict.target   = ObjDict.c
      makeObjDict.commands = python ~/CanFestival/canfestival-3-asc/objdictgen/objdictgen.py ObjDict.od ObjDict.c
      makeObjDict.depends  = ObjDict.od
      
      QMAKE_EXTRA_TARGETS += makeObjDict
      PRE_TARGETDEPS      += makeObjDict
      

      But all I get is an error:
      No rule to make target 'makeObjDict'

      Does anyone have an idea what I'm doing wrong?

      G Offline
      G Offline
      GregWilsonLindberg
      wrote on last edited by
      #2

      @GregWilsonLindberg, I've figured out how to get it to work, I had to add some clarification to the paths and the PRE_TARGETDEPS was wrong:

      makeObjDict.target   = ObjDict.c
      makeObjDict.commands = python ~/CanFestival/canfestival-3-asc/objdictgen/objdictgen.py $$PWD/ObjDict.od $$PWD/ObjDict.c
      makeObjDict.depends  = $$PWD/ObjDict.od
      
      QMAKE_EXTRA_TARGETS += makeObjDict
      PRE_TARGETDEPS      += ObjDict.c
      

      I guess that I was mis-understanding the line in the instructions about including the target in PRE_TARGETDEPS, it's the actual target file, in my case 'ObjDict.c', not the build target instructions 'makeObjDict'.
      The added '$$PWD/' are needed because the new target instructions don't run in the source directory, so a full path is necessary.

      1 Reply Last reply
      1

      • Login

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