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. Best way to resolve custom .pri filepath in subdir projects?

Best way to resolve custom .pri filepath in subdir projects?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 528 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.
  • btseB Offline
    btseB Offline
    btse
    wrote on last edited by
    #1

    My project consists of a bunch of subdirs of varying levels:

    project
      - project.pro
      - custom.pri
      - subdir1
         - subdir1.pro
         - subdir1a
            - subdir1a.pro
         - subdir1b
            - subdir1b.pro
      - subdir2
         - subdir2.pro
         - subdir2a
            - subdir2a.pro
      - subdir3
         - subdir3.pro
    

    custom.pri is included by all of the app/lib project files and contains custom build settings used by all projects. Right now I have hard coded the path to the custom.pri. For example, in subdir1a.pro I have:

    include(../../custom.pri)
    

    in subdir3.pro I have:

    include(../custom.pri)
    

    Is there a better way to achieve the including of the custom.pri without hardcoding the relative path?

    K 1 Reply Last reply
    0
    • btseB btse

      My project consists of a bunch of subdirs of varying levels:

      project
        - project.pro
        - custom.pri
        - subdir1
           - subdir1.pro
           - subdir1a
              - subdir1a.pro
           - subdir1b
              - subdir1b.pro
        - subdir2
           - subdir2.pro
           - subdir2a
              - subdir2a.pro
        - subdir3
           - subdir3.pro
      

      custom.pri is included by all of the app/lib project files and contains custom build settings used by all projects. Right now I have hard coded the path to the custom.pri. For example, in subdir1a.pro I have:

      include(../../custom.pri)
      

      in subdir3.pro I have:

      include(../custom.pri)
      

      Is there a better way to achieve the including of the custom.pri without hardcoding the relative path?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @btse

      It depends always what you are doing in custom.pri

      For some general things you can use .qmake.conf https://doc.qt.io/qt-5/qmake-environment-reference.html#qmakespec

      Vote the answer(s) that helped you to solve your issue(s)

      btseB 1 Reply Last reply
      3
      • K koahnig

        @btse

        It depends always what you are doing in custom.pri

        For some general things you can use .qmake.conf https://doc.qt.io/qt-5/qmake-environment-reference.html#qmakespec

        btseB Offline
        btseB Offline
        btse
        wrote on last edited by
        #3

        @koahnig I'm using it for quite a lot, including resolving lib dependencies and include paths. Anyways, how would using a .qmake.conf help? I would still have to specify the path for deeply nested subdir projects, wouldn't I?

        K 1 Reply Last reply
        0
        • btseB btse

          @koahnig I'm using it for quite a lot, including resolving lib dependencies and include paths. Anyways, how would using a .qmake.conf help? I would still have to specify the path for deeply nested subdir projects, wouldn't I?

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @btse

          Because it is read for all .pro files in sub folders.
          Best is to check with a statement of
          message("we are in .qmake.conf ") or similar that it is read. It has to be placed in the root folder of your project IIRC.
          Since it is read for all subfolders you might want to think twice what you have in there.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          3

          • Login

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