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 9171013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:06:20+00:00 2026-06-17T16:06:20+00:00

Is it possible to set up a TEMPLATE = subdirs .pro file such that

  • 0

Is it possible to set up a TEMPLATE = subdirs .pro file such that qmake -tp vc will set up project dependencies in the generated Visual Studio Solution?

I have tried using CONFIG += ordered followed by the SUBDIRS += <libdir> entries in the correct order but this seems to have no effect on the “Project Dependencies” setting in the solution properties dialog.

Thanks!

  • 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-17T16:06:21+00:00Added an answer on June 17, 2026 at 4:06 pm

    I am answering my own question since no one seems to have found a solution yet. As far as I can tell, there is still no way to set up Visual Studio Project Dependencies using a QT .pro file. We are using an executable that we developed (also using Qt) to do this manually after the project build is complete. The code used to build the executable works for Visual Studio 2010 solutions and appears below. It is fairly simple and updates your solution such that all included projects will depend on all projects input at the command line. ie. vcSlnDependencies filename.sln dependency1 dependency2 dependency3 will set all projects in filename.sln to depend on dependency1, dependency2, and dependency3. Obviously a project is never set to depend on itself. This code should be easily modifiable to allow for more complex dependency structures.

    #include <QFile>
    #include <QDir>
    #include <QFileInfo>
    #include <QStringList>
    #include <QUuid>
    #include <QTextStream>
    
    #include <iostream>
    #include <vector>
    #include <map>
    
    std::map<QString, QString> dependencyGuids;
    std::vector<QString> dependencies;
    
    int main(int argc, char *argv[])
    {
        if(argc<3)
        {
            std::cout << "Usage:" << std::endl << std::endl << "vcSlnDependencies filename.sln dependency1 dependency2 dependency3 ..." << std::endl;
    
            return -1;
        }
        else
        {
            for(int i = 2; i < argc; i++)
            {
                dependencies.push_back(argv[i]);
            }
        }
    
        QFile file(argv[1]);
        if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            std::cout << "Could not open sln file: " << argv[1] << "." << std::endl;
            return -1;
        }
    
        QFileInfo fileInfo(file);
    
        std::cout << "Processing " << fileInfo.fileName().toStdString() << std::endl;
    
        QByteArray fileData;
        fileData = file.readAll();
        file.close();
    
        QFile outFile(argv[1]);
        if(!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            std::cout << "Could not open sln file: " << argv[1] << "." << std::endl;
            return -1;
        }
    
        QTextStream reader(fileData);
        QTextStream writer(&outFile);
    
        //first populate the dependency guids
        while(!reader.atEnd())
        {
            QString currentLine = reader.readLine();
    
            for(unsigned int i = 0; i < dependencies.size(); i++)
            {
                if(currentLine.contains(dependencies[i]) && currentLine.contains(".vcxproj") && currentLine.contains("Project(\"{"))
                {
                    dependencyGuids[dependencies[i]] = currentLine.right(39).left(38);
                    std::cout << "Setting dependency GUID for " << dependencies[i].toLatin1().data() << " to " << currentLine.right(39).left(38).toLatin1().data() << "\n";
                }
            }               
        }
        reader.seek(0);
    
        //now update other projects with those dependencies
        while(!reader.atEnd())
        {
            QString currentLine = reader.readLine();
    
            writer << currentLine << "\n";
    
            if(currentLine.contains(".vcxproj") && currentLine.contains("Project(\"{"))
            {
                QString currentGuid = currentLine.mid(9,38);
    
                std::vector<QString> currentDependencies;
    
                for(std::map<QString, QString>::const_iterator iter = dependencyGuids.begin(); iter != dependencyGuids.end(); ++iter)
                {
                    if(iter->second != currentGuid)
                    {
                        currentDependencies.push_back(iter->second);
                    }
                }
    
                if(currentDependencies.size() > 0)
                {
                    writer << "\tProjectSection(ProjectDependencies) = postProject\n";
    
                    for(unsigned int i = 0; i < currentDependencies.size(); i++)
                    {
                        writer << "\t\t" << currentDependencies[i] << " = " << currentDependencies[i] << "\n";                  
                    }
    
                    writer << "\tEndProjectSection\n";
                }
            }       
        }
    
        writer.flush();
        outFile.close();
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to set up a cron job that will execute a php
Is is possible to set a light theme during development time in Visual studio
Is it possible to set z-index that only applies to a certain 'scope', such
Is it possible to set a form's ForeignKey field's queryset so that it will
Is it possible to set env vars in pom.xml that junit tests uses? Netbeans
Is it possible in ZendFramework to set custom template when I call some action
I have a template method that is designed to work with a specific set
Is it possible to write code template or a snippet which will do following:
I've set-up a basic template that contains custom fields meta: <?php /* Template Name:
In MEF it's possible to set the dependencies for an existing object using something

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.