Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Curious issue with builds...

Curious issue with builds...

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 2.7k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    I'm experimenting with two similar programs in one project. (They use different algorithms to solve the same problem.) I have two source files. When I change from file A to file B by editing my .pro file, it won't build unless I've modified file B.

    Knowing how make is driven off of file modification timestamps, I can see why this happens (I think). But, there are times like this when it may not be the desired behavior. I'd prefer not to rename my target based on the source file, but I will if there's no other option.

    Is there a better way to do this?

    Thanks.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      It probably builds because you have changed the .pro file. But why are you changing the .pro file anyhow?
      Wouldn't be two .pro files better?

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

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        I thought it would build when I changed the .pro file, but it doesn't seem to.

        I didn't realize you could have two .pro files. This is probably the right solution for this particular problem, but I'd like to better understand why it's not building under my current scenario.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          OK, sorry, my understanding was not correct.
          You could have also the .pro file as an dependency, which it does not have at the moment.

          I would suggest using completely different .pro files which I would place in different folders. However, most of the files, but just the file(s) with the algorithms would be identical. The executables will be build only when you have something and that is what you want to my understanding.

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

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #5

            bq. You could have also the .pro file as an dependency, which it does not have at the moment.

            Can you tell me more about this? That's exactly what I was hoping for.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              [quote author="mzimmers" date="1331153515"]bq. You could have also the .pro file as an dependency, which it does not have at the moment.

              Can you tell me more about this? That's exactly what I was hoping for.[/quote]
              Well, I know it more on a theoretical basis for qmake. I am using the msvc stuff. I have done only little things with qmake.

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

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on last edited by
                #7

                qmake supports the inclusion of other project files using the include() statement.
                @
                // common.pri

                SOURCES += commonFileA.cpp commonFileB.cpp commonFileC.cpp
                HEADERS += commonFileA.h commonFileB.h commonFileC.h

                // projectA.pro

                TEMPLATE = app
                include(common.pri)
                SOURCES += projectFileA.cpp
                HEADERS += projectFileA.h

                // projectB.pro

                TEMPLATE = app
                include(common.pri)
                SOURCES += projectFileB.cpp
                HEADERS += projectFileB.h
                @
                You can even combine both projects to a single project using the subdirs template (given the .pro files are in projectA/projectA.pro and projectB/projectB.pro).
                @
                // project.pro

                TEMPLATE = subdirs
                SUBDIRS = projectA projectB
                @

                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