[Moved] How to set Sources Directory in QMake
-
Well Raul, try to add "DEPENDPATH":http://doc.qt.nokia.com/latest/qmake-variable-reference.html#dependpath variable to *.pro file.
@#Something like this
...
DEPENDPATH += $$PWD/src
...@Good luck...
-
@mlong - yeah, I guess you're right, there is no other way to go, I'll just have to settle and have the src/ and include/ in my project files, thanks :)
@thanatos.jsse - on you DEPENDPATH, instead of using $$PWD/src you could use ./src instead, relative paths are allowed that way, just so you know ;)
-
Hi Raul,
I had the same problem and honestly did not find a good solution. You can use the following code at the pro file to include all files from a given directory to the source:
@SOURCES += src/*
@This idea will not avoid the the src/ in the file path but at least you will not to add a list of all files and paths to them at the pro file.
Best regards,
Leon -
If you want to split the file names and their location, you can use
@
VPATH += ./src
SOURCES += files1.cpp file2.cpp
@VPATH is somehow the equivalent for source files of nclude path for makefiles.
You can have a look at "qmake doc":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#vpath
-
@florent.revelut - cool thanks! that's almost what I need, too bad that Qt Creator still shows me the src and include as folders in the "sources" and "headers" section in the project tree, it would be nice if Qt Creator could dismiss that and use the vpath paths as root folders for sources.
Thanks!
-
[quote author="Raul" date="1301293630"]@florent.revelut - cool thanks! that's almost what I need, too bad that Qt Creator still shows me the src and include as folders in the "sources" and "headers" section in the project tree, it would be nice if Qt Creator could dismiss that and use the vpath paths as root folders for sources.
Thanks![/quote]
Hmmm... no thanks to that feature, if you ask me. I actually like that the separation into folders is preserved. Perhaps we organize our projects in different ways, but for me Creator just putting them on the same level would be going backwards.
-
André : well, I don't agree 100% percent with you.
Personnally, I like when I can split physical organisation and logical organisation.
Physical organisation has to deal with constraint, dependencies, configuration management (e.g. some part of code delivered by another team, from open source project, from other repository).
Logical organisation is how you want to display it in your UI, which is "human related"
Exemple:
- you can organise your code per layer in terms of configuration management (applicative, c++, C/ASM)
- you want to display your code per feature (i.e. per vertical slices of the layer)
Sometime, having 1 sub-project per folder just messes around with your ide.
From my point of view, he cleanest is to have a way to split representation from build, a bit like cmake allows to do it.
-
I can't believe I haven't had to ask this yet, but...
...what's the recommended technique for adding a directory to the header path? I want to start using the QDeclarativeView.h file, but my makefile doesn't know where to find it. Do I alter my UNIX $PATH variable? Manually edit the .pro file? Change some settings that I currently can't seem to find?
Thanks.