Closed DanKing-dev closed 2 months ago
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!
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.
@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!
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?)
@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?
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"
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?
@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.
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.
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response