Search code examples
eclipse-cdtqmake

absolute path in qmake pro file


We are keeping a qmake project file in source control. Since every user can check out the project to a different path, it's causing some problems in version controlling.

For instance Every time project is updated, we have to go into project file manually and fix the paths in the file.

What is the best solution to deal with it? I am thinking about using an environment variable and assigning environment variable to variables in project file but I also wonder if there is a better approach.


Solution

  • The safest solution is to only use relative paths in the qmake files. That way, it doesn't matter where users check out to.

    In my experience, depending on users setting environment variables causes lots of fragilities, and should be avoided at all costs, e.g.

    • User moves to a different build space, but forgets to update the variable, so they end up building the wrong thing
    • User thinks that environment variables are a good idea, so adds another environment variable that changes some other aspect of the behaviour of the build (e.g. compiler flags) and your builds end up not reproducible.