Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9291881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:45:08+00:00 2026-06-18T20:45:08+00:00

I have the fololowing directory structure and I would like to simplify things using

  • 0

I have the fololowing directory structure and I would like to simplify things using the Qt .pri files.

Project1/
    project1.pro
    main.cpp
    Algorithms/
        algorithm1.h
        algorithm1.cpp
        ...
        // add an algorithms.pri file here
    Utilities/           
        utiliy1.h
        utiliy1.cpp
        ...
        // add an utilities.pri file here
    Gui/
        gui1.h
        gui1.cpp
        ...
        // add a gui.pri file here

AlgorithmsUnitTest/
     algorithms_unit_test.pro
     main.cpp

UtilitiesUnitTest/
     utilities_unit_test.pro
     main.cpp

One of the problems I am trying to solve is, that when I add or remove a source file from one of the Algorithms, Utilities or Gui folders, I have to remove it from all the other .pro files.

I would like to create a .pri file for each folder containing source and header files in that folder. These files would be included from all the other projects. Then if I add/remove a source or header file, I would remove it only from the corresponding .pri file.

The problem with this approach is that the inclusion of a .pri file in a .pro file is just a simple copy-paste. That is if algorithms_unit_test.pro included the algorithms.pri file, the qmake build system would look for the files in a nonexisting AlgorithmsUnitTest/Algorithms folder.

The solution would be to prepend the contents of the .pri file with

../Project1/

But I do not know how to do this. Please could you teach me how to do it or suggest some other way to organize my projects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:45:09+00:00Added an answer on June 18, 2026 at 8:45 pm

    You can use the qmake variable PWD in yours .pri files.

    algorithms.pri

    SOURCES      += $$PWD/algorithm1.cpp
    HEADERS      += $$PWD/algorithm1.h
    

    utilities.pri

    SOURCES      += $$PWD/utiliy1.cpp
    HEADERS      += $$PWD/utiliy1.h
    

    …

    http://doc.qt.digia.com/qt/qmake-variable-reference.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following directory structure on my Apache web root. I would like
I have the following directory structure: /some_project source.js package.json I would like to install
I have the following directory structure: /home/tichy/xxx/yyy/aaa /home/tichy/xxx/yyy/aab /home/tichy/xxx/yyy/aac I would like to enter
I have a bunch of files in a single directory that I would like
I would like to list all files recursively in a directory. I currently have
I have the following directory structure: Main.py A/ __init__.py B/ __init__.py C/ __init__.py The
I have the following url structure: http://localhost/sitename/views/www/page.php I would like for page.php to show
If I have a directory structure like so / ├── home │ └── user
I have the original images in a directory structure that looks like this: ./Alabama/1.jpg
I have two things that I would like to do with my matlab function.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.