Skip to content
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

Clean Reconfigure All Projects removes wrong files after switching kit #2326

Closed
tvstensby opened this issue Jan 14, 2022 · 2 comments · Fixed by #2335
Closed

Clean Reconfigure All Projects removes wrong files after switching kit #2326

tvstensby opened this issue Jan 14, 2022 · 2 comments · Fixed by #2335
Labels
bug a bug in the product Feature: configure
Milestone

Comments

@tvstensby
Copy link

Brief Issue Summary

I have a project that uses multiple kits. The cmake.buildDirectory is set to ${workspaceFolder}/build-vscode/${buildKit} so that build files associated with different kits are located in different directories.

If I switch from one kit to another and then perform the action Clean Reconfigure All Projects then the CMakeCache.txt and CMakeFiles associated with the previous kit are deleted before the cmake configure command is run. This causes the reconfiguration of the new kit to behave as a regular configure, while the configuration associated with the previous kit is lost.

Expected behavior

Only files in the current build directory should be affected when running Clean Reconfigure All Projects.

Actual behavior

A combination of files from two build directories are affected.

Debug Log

The log below shows relevant parts of the log when performing the following actions:

  1. Configure the project using the Visual Studio 2019 kit
  2. Switch to the Emscripten kit
  3. Clean Reconfigure the project using the Emscripten kit

Notice that the build directory is wrong in the lines starting with [driver] Removing. These should contain Emscripten_WASM rather than Windows_x64_msvc142.

[main] Configuring folder: MyProject
[proc] Executing command: C:\cmake-3.16.3-win32-x86\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:STRING=c:/MyProject/install/Windows_x64_msvc142 -Hc:/MyProject -Bc:/MyProject/build-vscode/Windows_x64_msvc142 -G "Visual Studio 16 2019" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is MSVC 19.29.30137.0
.
.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: C:/MyProject/build-vscode/Windows_x64_msvc142

[driver] Switching to kit: Emscripten_WASM

[main] Configuring folder: MyProject 
[driver] Removing c:/MyProject/build-vscode/Windows_x64_msvc142/CMakeCache.txt
[driver] Removing c:\MyProject\build-vscode\Windows_x64_msvc142\CMakeFiles
[proc] Executing command: C:\cmake-3.16.3-win32-x86\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:STRING=c:/MyProject/install/Emscripten_WASM -DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/emsdk-v3.1.0/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DENABLE_EMSCRIPTEN_WASM:STRING=ON -DENABLE_EMSCRIPTEN_PTHREADS:STRING=OFF -Hc:/MyProject -Bc:/MyProject/build-vscode/Emscripten_WASM -G Ninja
.
.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: C:/MyProject/build-vscode/Emscripten_WASM

Kits used

The kits should not matter for reproducing this bug, but I am including them just in case.

[
	{
		"name": "Emscripten_WASM",
		"toolchainFile": "C:/emsdk-v3.1.0/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
		"preferredGenerator": {
			"name": "Ninja"
		},
		"cmakeSettings": {
			"ENABLE_EMSCRIPTEN_WASM": "ON",
			"ENABLE_EMSCRIPTEN_PTHREADS": "OFF"
		}
	},
	{
		"name": "Windows_x64_msvc142",
		"visualStudio": "fb3a9399",
		"visualStudioArchitecture": "x64",
		"preferredGenerator": {
			"name": "Visual Studio 16 2019",
			"platform": "x64",
			"toolset": "host=x64"
		}
	}
]
@bobbrow
Copy link
Member

bobbrow commented Jan 21, 2022

Thank you for reporting this issue. I am able to reproduce it and have a fix ready for PR.

@bobbrow
Copy link
Member

bobbrow commented Mar 1, 2022

The fix for this issue is available in 1.10 "pre-release". You can help us validate it by:

  1. Opening the extensions panel in VS Code
  2. Selecting the CMake Tools extension
  3. Clicking the "Switch to Pre-release Version" button

image

@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2022
@bobbrow bobbrow modified the milestones: On Deck, 1.10.0 Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: configure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants