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 #define to main .pro
QtWS25 Last Chance

Adding #define to main .pro

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 281 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I like to add single place to control preprocessor entries AKA #define for example.

    I can add "common #define" to subdir project subproject .pro

    DEFINES += "TEST_FLOW_CHART"

    works as expected

    Adding same to main .pro file does not work.
    Is there any other way / place to have / add common directives ?

    I believe GCC has some "additional processing" options, but I forgot how to do that . But doing this in main .pro would be proffered.

    1 Reply Last reply
    0
    • Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by
      #2

      @AnneRanch said in Adding #define to main .pro:

      Is there any other way / place to have / add common directives ?

      Yes, you can, for example, create a common.pri file like:

      DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
      

      Then include that *.pri from all of your *.pro files, like:

      include(../common.pri)
      

      Of course, adjust the path to common.pri accordingly.

      Here's a real-world (albeit pretty old) example from one of my open source projects:

      • ./common.pri
      • ./src/src.pro - includes common.pri
      • ./test/test.pro - also includes common.pri

      Cheers.

      A 1 Reply Last reply
      1
      • Paul ColbyP Paul Colby

        @AnneRanch said in Adding #define to main .pro:

        Is there any other way / place to have / add common directives ?

        Yes, you can, for example, create a common.pri file like:

        DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
        

        Then include that *.pri from all of your *.pro files, like:

        include(../common.pri)
        

        Of course, adjust the path to common.pri accordingly.

        Here's a real-world (albeit pretty old) example from one of my open source projects:

        • ./common.pri
        • ./src/src.pro - includes common.pri
        • ./test/test.pro - also includes common.pri

        Cheers.

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @Paul-Colby Thanks for the reply. Just for sake of discussion - what would be the benefit of adding EXTRA file to EACH suboproject ?
        Besides it does not meet the post " specification" to " add single place to control preprocessor" to main .pro.
        Cheers

        1 Reply Last reply
        0

        • Login

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