-
Bug
-
Resolution: Incomplete
-
P4: Low
-
None
-
Qt Creator 4.7.0-rc1
-
None
-
Linux (Ubuntu, RHEL) with git or subversion installed
When I set an environment variable using %{CurrentProject:VcsTopLevelPath} as its value in the Kit configuration, the variable gets correctly expanded in the project Build Environment, but the environment variable is empty or has incorrect value during compilation under specific circumstances.
Steps to reproduce the issue:
- Open the Kit configuration and set the following environment variable: ROOT_DIR=%{CurrentProject:VcsTopLevelPath}
- Download the attached archive and extract it somewhere
- Open the test/test.pro file
- Configure the project using the previously configured Kit
- In the General Messages pane, the following message will appear: "Project MESSAGE: <some_path>/test"
- Right-click on the project and select "Run qmake". The same message as above will appear in the Compile Output pane, but highlighted in red
- Now close the project and open it again
- In the General Messages pane, the following message will appear: "Project MESSAGE: " (note the empty path)
- Run qmake again. The same message as above (with empty path) will appear in the Compile Output pane, but highlighted in red
Steps to workaround the issue:
- Go to the project build settings in the Projects tab
- Expand the Build environment details
- Select Clear system environment and wait for Qt Creator to process the changes
- Deselect Clear system environment and wait for Qt Creator to process the changes
- Now go back to the editor and run qmake
- The correct path appears in the Compile Output pane
This issue is very annoying because sometimes, when I'm working with many projects in the same session, the environment variable will retain the value of previously active projects, thus leading to tricky situations where I get strange compilation errors.
Note: our projects depend on a similar-named environment variable and we want to use VcsTopLevelPath as a convenience. We actually use Subversion for version control, but in this minimal example I used Git.
Edit: please see the last comments. I found other related issues.