microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 452 forks source link

CMake Cache Editor will cause unmatch toolset #1618

Closed Demonese closed 3 years ago

Demonese commented 3 years ago

Brief Issue Summary

  1. execute CMake: Configure
  2. open CMake Cache Editor Edit CMake Cache (UI), modify any value and save

CMake Tools Log

first time configure

[main] Configuring folder: 1.0.6 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hi:/Library/bzip2/.build/1.0.6 -Bi:/Library/bzip2/.build/1.0.6/build -G "Visual Studio 16 2019" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
[cmake] -- The C compiler identification is MSVC 19.28.29335.0
[cmake] -- The CXX compiler identification is MSVC 19.28.29335.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: I:/Library/bzip2/.build/1.0.6/build

edit CMake Cache and save

[main] Configuring folder: 1.0.6 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -Hi:/Library/bzip2/.build/1.0.6 -Bi:/Library/bzip2/.build/1.0.6/build -G "Visual Studio 16 2019" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: Error: generator toolset: host=x64
[cmake] Does not match the toolset used previously: host=host=x64
[cmake] Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

reopen vscode

[main] Configuring folder: 1.0.6 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hi:/Library/bzip2/.build/1.0.6 -Bi:/Library/bzip2/.build/1.0.6/build -G "Visual Studio 16 2019" -T host=host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
[cmake] CMake Error at CMakeLists.txt:2 (project):
[cmake]   Generator
[cmake] 
[cmake]     Visual Studio 16 2019
[cmake] 
[cmake]   given toolset specification
[cmake] 
[cmake]     host=host=x64
[cmake] 
[cmake]   that contains invalid field 'host=host=x64'.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "I:/Library/bzip2/.build/1.0.6/build/CMakeFiles/CMakeOutput.log".

(no error in "I:/Library/bzip2/.build/1.0.6/build/CMakeFiles/CMakeOutput.log") CMakeOutput.log

Platform and Versions

andreeis commented 3 years ago

Thank you for reporting this problem. We are able to reproduce and will be fixing this soon. Resolving this as a duplicate of https://github.com/microsoft/vscode-cmake-tools/issues/1613 which was created earlier.