When a cmake.toolset and cmake.platform are set in settings.json, they are used correctly on the first CMake configuration.
After restarting VS Code, on subsequent configurations, these values are mixed up when read from CMakeCache.txt.
In src/drivers/cmfileap-driveri.ts (line 68 in the develop branch), toolset should be platform and platform should be toolset.
toolset: cache.get('CMAKE_GENERATOR_PLATFORM') ? cache.get('CMAKE_GENERATOR_PLATFORM')!.value : undefined,
platform: cache.get('CMAKE_GENERATOR_TOOLSET') ? cache.get('CMAKE_GENERATOR_TOOLSET')!.value : undefined
May relate to #222.
First CMake Configuration works, all subsequent CMake configurations work. CMake command line should be:
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -Hc:/Code/myProj -Bc:/Code/myProj/build -G "Visual Studio 14 2015" -T v140 -A x64
For subsequent builds, platform and toolset are reversed, resulting in the error:
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -Hc:/Code/myProj-Bc:/Code/myProj/build -G "Visual Studio 14 2015" -T x64 -A v140
[cmake] CMake Error: Error: generator platform: v140
[cmake] Does not match the platform used previously: x64
settings.json:
{
"cmake.generator": "Visual Studio 14 2015",
"cmake.toolset": "v140",
"cmake.platform":"x64",
}
[main] Configuring folder: myProj
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -Hc:/Code/myProj-Bc:/Code/myProj/build -G "Visual Studio 14 2015" -T x64 -A v140
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: Error: generator platform: v140
[cmake] Does not match the platform used previously: x64
[cmake] Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
Thanks for catching this. Should be an easy fix.
I confirm this bug which is pretty annoying since it forces me to recreate the build directory every time I restart VS Code.
However in my case I have nothing related to cmake.toolset and cmake.platform in settings.json (I checked workspace and user settings). I'm just using the "CMake: Select Kit" command the first time I configure, after that vscode-cmake-tools seems to be able to remember what to use even if it's not in my settings, but as mentionned in the issue it put "-T x64" in the command line instead of "-A x64".
@Celeborn2BeAlive I have been getting away with just deleting CMakeCache.txt from my build folder before opening VS Code again.
Still a pain, but at least you don't lose your built object files.
The bug may be temporarily worked around by enabling cmake server in preferences.
"cmake.useCMakeServer": true
Fixed in 1.3.1