-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake-tools-kits environmentSetupScript having no effect on env.PATH variable #4091
Comments
@KorkiFork We are trying to reproduce your issue, but have a problem finding “MSVC kit A” and “MSVC kit B”, could you provide us with a reproduction folder? This will help us a lot in reproducing and investigating the issue, thank you! |
I attached the cmake-tools-kits.json file, please try using it. (Sorry for closing and reopening issue, not sure how this comment system works, it is a bit strange). |
Never mind I've reopened this issue, could you provide us with a project that can reproduce the issue? It's not just the cmake-tools-kits.json file, we can't reproduce the issue by adding the cmkae-tools-kits.json file to our project. |
I already provide you a CMake project via a CMakeLists.txt in my original post (please check my first post again, below the kits definition, there is also a CMakeLists.txt file). |
Hi @Yingzi1234, I noticed that your cmake-tools.kits.json has errors (as you can see for example on lines 2 and 16, which are underlined with red markings). Because the cmake-tools.kits.json file has errors, the CMake Tools extension can't load it, and it will still display the old kits (kits that have been loaded the last time when the cmake-tools-kits.json file was valid). The cmake-tools-kits.json I provided you starts and ends with square brackets "[" ... "]", on line 1 and 36, but yours starts and ends with curly brackets "{" ... "}". Could you please try correcting this? I just realized that in my initial post, I also added curly brackets by mistake in lines 1 and 36, I'm sorry for that. Those should be square brackets. |
@Yingzi1234 Hi again. I'm not sure why the kits are not recognized for you. Maybe you don't edit them in you user folder? 01.mp4Further, I realized that my example is not correct is some cases and I won't configure the project at all.
After I made those adaptations, I recorder the example of the PATH variable having different values with kit A and B. 02.mp4 |
Hi @KorkiFork , thank you very much for your reply, the reason for the failure to reproduce may be due to the name of the file. We have now been able to reproduce your issue on the latest CMake tool version v1.20.10(pre-release). You can get the detailed steps to reproduce it below. ENV: Repro steps:
Actual result: Output log: MSVC kit B: |
@Yingzi1234 Thank you very much for the support and patience. I will be glad to see this bug being resolved in the future. |
Brief Issue Summary
Tested with: CMake Tools v1.20.10 (pre-release). All prior versions, released within the last year or two, had the same issue.
In the cmake-tools-kits file, if a kit has an environmentSetupScript which modifies the system PATH, and if in the same kit the environmentVariables object sets the variable PATH to have the value ${env.PATH}, the resulting PATH value will equal the PATH value prior to calling the environmentSetupScript.
TL;DR environmentSetupScript does not effect the value returned by ${env.PATH}.
E.g.
I used MSVC build tools 2017 v14.16, but any other MSVC build tools version can be taken (2019, 2022 etc.) and installed it on the default location.
In the kit description, I explicitly set CMAKE_MAKE_PROGRAM to the path of nmake.exe in order to simplify this example (please ignore why I had to do this, just take it as it is).
If any of the below two kits is used with the example CMakeLists.txt I provided below, during the project's build tree configuration, a STATUS message will be printed, which will contain the value of the system PATH variable.
If the "MSVC kit A" is used, the printed PATH variable will contain directories that have been added by the environmentSetupScript.
If the "MSVC kit B" is used, the printed PATH variable will NOT contain directories that should have been added by the environmentSetupScript, but it will contain the system PATH value prior to calling the environmentSetupScript.
cmake-tools-kits.json
CMakeLists.txt
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: