Curious issue with builds...
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?
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?
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.
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.
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 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.
qmake supports the inclusion of other project files using the include() statement.
SOURCES += commonFileA.cpp commonFileB.cpp commonFileC.cpp
HEADERS += commonFileA.h commonFileB.h commonFileC.h
TEMPLATE = app
SOURCES += projectFileA.cpp
HEADERS += projectFileA.h
TEMPLATE = app
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).
TEMPLATE = subdirs
SUBDIRS = projectA projectB