vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

"Delete Cache and Reconfigure" not working properly

Open 424778940z opened this issue 1 year ago • 9 comments

Brief Issue Summary

My use case is a bit odd, I'm swaping between few computers for work, and my project folder is synced by usb drive or network drive.

That means the abs path won't be same between computers. So when I try to build after move computer, cmake will complain some config issues caused by path chage, understandable.

However, when I select CMake: Delete Cache and Reconfigure, the cache is not fully cleared, cmake is still complaining something in CMakeCache.txt isn't right, unless I manually remove the build folder entirely.

Make things worse, sometime it seems vscode/cmake is holding build folder open so I cannot remove it within vscode, I have to close everything then remove the folder and open everything again.

Could we have an option to force remove build folder or make the ext clear cache properly?

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

424778940z avatar Dec 26 '23 03:12 424778940z

Hi @424778940z, could you please provide us with a sample project that reproduces your issue? It would be much easier to investigate with it, thanks!

snehara99 avatar Jan 02 '24 18:01 snehara99

Hi @424778940z, could you please provide us with a sample project that reproduces your issue? It would be much easier to investigate with it, thanks!

nothing complex, it's not about the project, it's caused by system / source pathchange even a simple hello world should be able to reproduce the issue

  1. create a simple hello world cmake project
  2. compile on current computer with whatever version of gcc (or other compilers)
  3. copy the whole folder to another computer's different path
  4. build again
  5. you get the error from cmake (which is totally fine)
  6. clear cache in vscode
  7. build again
  8. you still get the error from cmake (which is not fine...)

424778940z avatar Jan 02 '24 19:01 424778940z

@424778940z Thank you for the detailed repro steps. We'll investigate the issue as soon as we have enough capacity.

snehara99 avatar Jan 12 '24 15:01 snehara99

@424778940z Two members from our team attempted the repro and it didn't reproduce. If there is any other information you could provide that might help us reproduce, that would be great, otherwise, we will close the issue.

qarni avatar Feb 29 '24 19:02 qarni

@424778940z Could you confirm whether this is still reproducing? Specifically on the most recent pre-release CMake Tools version? Thank you!

gcampbell-msft avatar Mar 27 '24 16:03 gcampbell-msft

image Here is an example, which is my tiny C playground for some quick testing, which the cmakelist.txt only few lines, and a single source code It was built at C:/_projects/_playgrounds/c_std_pg, then I copy the whole c_std_pg folder to d:/c_std_pg, then cmake will complain about the location change, which is fine, but the "Clean" or "Clean and rebuild" from Cmaketools won't work because cmake refuse to work due to location change

hummm, seems the CMake: Delete Cache and Reconfigure is working now, before it was like the cache is not fully removed, somehow the cmakecache.txt still had the old information I will test on my Linux machine tomorrow see if that works too...

424778940z avatar Mar 27 '24 17:03 424778940z

Confirmed it is working under linux. We could close the issue now

424778940z avatar Mar 27 '24 17:03 424778940z

unfortunately, I have to open this issue again, it seems the CMake: Delete Cache and Reconfigure is only removing following two files, but in some cases, this is NOT enough, as there are many things in the build folder. I can't give you the whole project to repurduce the issue, but could you just give an option to let CMake: Delete Cache and Reconfigure nuke the whole build folder instead of removing those two files?

[driver] Removing /home/user/Desktop/firmware/.build/CMakeCache.txt
[driver] Removing /home/user/Desktop/firmware/.build/CMakeFiles

424778940z avatar Apr 25 '24 09:04 424778940z

@424778940z @gcampbell-msft Thanks for your feedback, we can reproduce the problem using the following environment and steps and we will continue to follow the issue:

ENV:

  • OS: Win10 22H2
  • VS Code version: 1.88.1
  • CMake Tools extension: 1.18.31(pre-release)

Repro Steps:

  1. Download and unzip Test project.
  2. Open Test project with VS Code.
  3. Press F1 and run command 'CMake: Delete Cache and Reconfigure'.

Expected Result: Provide an option to delete the entire build folder, not just the two files.

Actual Result: Only CMakeCache.txt/CMakeFiles have been removed. Before running the 'CMake: Delete Cache and Reconfigure' command: image

After running the 'CMake: Delete Cache and Reconfigure' command: [driver] Removing c:/Users/v-ericawu/Desktop/Test/build/CMakeCache.txt [driver] Removing c:\Users\v-ericawu\Desktop\Test\build\CMakeFiles image

v-ericawu avatar Apr 29 '24 08:04 v-ericawu

Verified on CMake Tools v1.18.43(release), this issue still repro: only CMakeCache.txt/CMakeFiles have been removed. image

Ashley-Li avatar Jul 09 '24 09:07 Ashley-Li

@Ashley-Li Did you turn on the setting that was added?

gcampbell-msft avatar Jul 09 '24 13:07 gcampbell-msft

@gcampbell-msft Thank you for your guidance. After setting cmake.deleteBuildDirOnCleanConfigure is true, this issue has fixed. Now deleted the entire build folder, not just the two files. image

Ashley-Li avatar Jul 10 '24 06:07 Ashley-Li

could we have a checkbox for this option in settings menu?

424778940z avatar Jul 10 '24 09:07 424778940z

could we have a checkbox for this option in settings menu?

Hi @424778940z Please press "Ctrl+," to open setting page, then search keywords and find "Cmake:Delete Build Dir On Clean Configure" and switch to Workspace, then select the checkbox to enable. Please see below: image

Ashley-Li avatar Jul 10 '24 09:07 Ashley-Li