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. Including multiple .pri files similar to Makefiles
Qt 6.11 is out! See what's new in the release blog

Including multiple .pri files similar to Makefiles

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 842 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.
  • HunterMetcalfeH Offline
    HunterMetcalfeH Offline
    HunterMetcalfe
    wrote on last edited by
    #1

    As I stated in a previous post, I'm not a genius with Qt's pro file. I was hoping that it worked similar to Makefile includes. For example, I'm creating a directories.pri that defines the directory locations, in the form of My_Directory = /home/usr/buildarea/ of some libraries. From there I have a top level defaults.pri that includes directories.pri and then uses the $${My_Directory} to resolve paths for libs and such. Both directories.pri and defaults.pri live on the same directory level. In a sub directory I have a file including defaults.pri, but none of the directories defined in directories.pri are resolving. In fact doing a !include(directories.pri) resolves as true. Why is my sub directory's .pro unable to resolve the other pri file. Is it searching at it's own directory level instead of where defaults.pri includes it? Can you include only one .pri file?

    aha_1980A 1 Reply Last reply
    0
    • HunterMetcalfeH HunterMetcalfe

      As I stated in a previous post, I'm not a genius with Qt's pro file. I was hoping that it worked similar to Makefile includes. For example, I'm creating a directories.pri that defines the directory locations, in the form of My_Directory = /home/usr/buildarea/ of some libraries. From there I have a top level defaults.pri that includes directories.pri and then uses the $${My_Directory} to resolve paths for libs and such. Both directories.pri and defaults.pri live on the same directory level. In a sub directory I have a file including defaults.pri, but none of the directories defined in directories.pri are resolving. In fact doing a !include(directories.pri) resolves as true. Why is my sub directory's .pro unable to resolve the other pri file. Is it searching at it's own directory level instead of where defaults.pri includes it? Can you include only one .pri file?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @HunterMetcalfe

      It's a bit hard for me to understand your setup.

      Can you upload a concrete example of what you are doing?

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • HunterMetcalfeH Offline
        HunterMetcalfeH Offline
        HunterMetcalfe
        wrote on last edited by
        #3

        @aha_1980 As I was typing out the entire structure i figured out my issue ( an aha moment indeed). I was trying to use a directory defined in directories.pri by using $(Directory) instead of $${Directory}. I'll still show my directory so others will learn as well.

        Application Directory Structure

        • Application

        • itemdirectories.pri
        • defaults.pri
        • application
           application.pro
           *.hpp - headers
           *.cpp – sources

        directories.pri
        MY_DIR = $(TOPDIR)/library #TOPDIR is set at the environment

        defaults.pri
        include(./directories.pri)
        LIBS += -L$${MY_DIR)/lib \ #My mistake here was I had $(MY_DIR) instead of $${MY_DIR}
        INCLUDEPATH += $${MY_DIR}/inc \

        application.pro
        include(../defaults.pri)

        aha_1980A 1 Reply Last reply
        2
        • HunterMetcalfeH HunterMetcalfe

          @aha_1980 As I was typing out the entire structure i figured out my issue ( an aha moment indeed). I was trying to use a directory defined in directories.pri by using $(Directory) instead of $${Directory}. I'll still show my directory so others will learn as well.

          Application Directory Structure

          • Application

          • itemdirectories.pri
          • defaults.pri
          • application
             application.pro
             *.hpp - headers
             *.cpp – sources

          directories.pri
          MY_DIR = $(TOPDIR)/library #TOPDIR is set at the environment

          defaults.pri
          include(./directories.pri)
          LIBS += -L$${MY_DIR)/lib \ #My mistake here was I had $(MY_DIR) instead of $${MY_DIR}
          INCLUDEPATH += $${MY_DIR}/inc \

          application.pro
          include(../defaults.pri)

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @HunterMetcalfe

          I like people getting aha moments when reading my posts :)

          Glad you figured it out and thanks for sharing.

          Regards

          Qt has to stay free or it will die.

          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