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

1.19.49 Deletes Cache on Folder Open #4018

Closed
DanKing-dev opened this issue Aug 29, 2024 · 8 comments
Closed

1.19.49 Deletes Cache on Folder Open #4018

DanKing-dev opened this issue Aug 29, 2024 · 8 comments
Labels
more info needed More info is needed from the community for us to properly triage and investigate. triage

Comments

@DanKing-dev
Copy link

Brief Issue Summary

In Visual Studio Code, on opening a folder, the CMakeCache.txt file is summarily deleted.

I am using a cross-compiler and this behavior immediately breaks my ability to build my projects.

This did not happen in the previous version.

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --version
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -E capabilities
[kit] Successfully loaded 7 kits from C:\Users\Foo\AppData\Local\CMakeTools\cmake-tools-kits.json
[variant] Loaded new set of variants
[cmakefileapi-driver] Removing c:/Users/Foo/project/code/build/CMakeCache.txt

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@gcampbell-msft
Copy link
Collaborator

This is likely due to the cmake.configureOnOpen setting being set to true. Therefore, the extension should be configuring on open. If this is something you don't want, please change the cmake.configureOnOpen setting. Please let us know if this solves your issue, and if not, please provide a repro project, thanks!

@gcampbell-msft gcampbell-msft added the more info needed More info is needed from the community for us to properly triage and investigate. label Aug 29, 2024
@the-programmer
Copy link

the-programmer commented Aug 29, 2024

It seems I have a similar issue. In version v1.18.44 everything was fine and in C1.19.49 somehow the Visual studio C compiler is selected (instead of my cross-compile chain).

I have cmake.configureOnOpen set to true, however with v1.18.44 this doesn't give any issues.

The startup log at v1.18.44

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --version
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" -E capabilities
[variant] Loaded new set of variants
[main] Configuring project: [...] 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Wno-dev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON --no-warn-unused-cli -SC:/Development/[...] -Bc:/Development/[...]/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 12.3.1
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.3 rel1/bin/arm-none-eabi-gcc.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Configuring done (1.3s)
[cmake] -- Generating done (0.2s)
[cmake] -- Build files have been written to: C:/Development/[...]/build

And the startup log with v1.19.49

[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --version
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" -E capabilities
[variant] Loaded new set of variants
[cmakefileapi-driver] Removing c:/Development/[...]/build/CMakeCache.txt
[main] Configuring project: [...] 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Wno-dev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON --no-warn-unused-cli -SC:/Development/[...] -Bc:/Development/[...]/build
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Building for: Visual Studio 17 2022
[cmake] -- The C compiler identification is MSVC 19.40.33813.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Configuring done (13.7s)
[cmake] -- Generating done (0.3s)
[cmake] -- Build files have been written to: C:/Development/[...]/build

Yes, I have installed Visual studio 17. As a test I also renamed C:\Users\[...]\AppData\Local\CMakeTools\cmake-tools-kits.json (since that is normally used to detect the installed kits). However on version 1.19.49 this has no effect.

@gcampbell-msft
Copy link
Collaborator

@the-programmer @DanKing-dev This is expected, the cmake.configureOnOpen is defaulted to true so it will automatically reconfigure when you open your project to ensure that everything is up to date. If you don't want this, you can simply turn that setting off. Thanks!

I'll close this issue since it's expected and controllable by a setting. Thanks for posting it!

@github-project-automation github-project-automation bot moved this from Blocked to Completed in CMake Tools Aug 29, 2024
@the-programmer
Copy link

I'm sorry but setting cmake.configureOnOpen to false didn't fix the underlying issue.

Now I have to press "Clean Reconfigure All Projects" in order to trigger the issue. (Shall I make a new issue for this?)

@gcampbell-msft
Copy link
Collaborator

gcampbell-msft commented Aug 29, 2024

@the-programmer I'm not sure I'm understanding your issue. Running Clean Reconfigure All Projects means that it will certainly delete the files and reconfigure, this is expected behavior.

Is there something I'm misunderstanding about your expectations here?

@the-programmer
Copy link

the-programmer commented Aug 29, 2024

Hi @gcampbell-msft, yes there seems to be different issues in play.

As seen in my first comment, cmake tools 1.19 seems to select a different compiler than with 1.18. On both versions the cmakefile is the same.

Note that I and @DanKing-dev are both cross compiling.

So a better title would be "cmake tools selects on 1.19 a different compiler than on 1.18 when reconfiguring"

@gcampbell-msft
Copy link
Collaborator

Okay, to fully be able to understand and investigate your issue, could you please create a new issue with a detailed repro project, repro steps, and the output of the cmake "Log Diagnostics" output?

@gcampbell-msft
Copy link
Collaborator

@DanKing-dev I wonder if your issue is actually #4005. It's using a different generator and so it's grabbing a different compiler? Are you using kits?

Either way, follow the steps from my last comment in order to get the best help. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More info is needed from the community for us to properly triage and investigate. triage
Projects
Status: Completed
Development

No branches or pull requests

3 participants