Configuring a QMake project - custom variables with paths to libraries
-
Hello
My project uses some third party libraries that can reside anywhere, in a location not relative to project directory. Currently I add them in my .pro file with hardcoded absolute paths like this:INCLUDEPATH += 'C:\Program Files\Somelibrary\Include'
This is fine as long as I'm the only one working on the project. However I'd like to let other developers clone, build and commit to my repository. What is the best way to let them configure the project and specify paths where they placed these libraries, without them having to modify the .pro file?
I had two ideas:
- using a .pri file what would contain all paths as variables and would not be tracked by version control, so that every developer could have his own paths there
- using properties as here
I was unable to find any public projects that would use either of these methods and I couldn't find any descriptions of a correct way to do this. So I'd like to ask you guys for help.
-
Hi,
You can do that up to a point. If you have 10 dependencies that everybody can put anywhere they wish, you won't be able to have a generic solution.
What could be done is the documentation of a preferred structure for the dependencies to be stored in and then use for example an environment variable that points to the root folder of these dependencies. IIRC, CUDA is using something like that on Windows at least.
The pri file solution that you suggest could take advantage of that for example.