vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Make sure "toolset" keyword is generated for all the VS generators that support it

Open andreeis opened this issue 3 years ago • 3 comments

@andreeis I am experiencing the same issue with visual studio code 1.57.1 and the CMake Tools extension's version 1.7.3. I see your fix in the release notes. Therefore there is certainly something I am doing wrong. Here's my cmake-tools-kits.json:

[
  {
    "name": "GCC 9.2.0",
    "compilers": {
      "C": "C:\\MinGW\\bin\\gcc.exe",
      "CXX": "C:\\MinGW\\bin\\g++.exe"
    },
    "preferredGenerator": {
      "name": "MinGW Makefiles"
    },
    "environmentVariables": {
      "CMT_MINGW_PATH": "C:\\MinGW\\bin"
    }
  },
  {
    "name": "GCC 9.2.0 mingw32",
    "compilers": {
      "C": "C:\\MinGW\\bin\\mingw32-gcc.exe",
      "CXX": "C:\\MinGW\\bin\\mingw32-g++.exe"
    },
    "preferredGenerator": {
      "name": "MinGW Makefiles"
    },
    "environmentVariables": {
      "CMT_MINGW_PATH": "C:\\MinGW\\bin"
    }
  },
  {
    "name": "GCC for mingw32 9.2.0",
    "compilers": {
      "C": "C:\\MinGW\\bin\\mingw32-gcc.exe",
      "CXX": "C:\\MinGW\\bin\\mingw32-g++.exe"
    },
    "preferredGenerator": {
      "name": "MinGW Makefiles"
    },
    "environmentVariables": {
      "CMT_MINGW_PATH": "C:\\MinGW\\bin"
    }
  },
  {
    "name": "Visual Studio Professional 2019 Release - amd64",
    "visualStudio": "33a40df0",
    "visualStudioArchitecture": "x64",
    "preferredGenerator": {
      "name": "Visual Studio 16 2019",
      "platform": "x64",
      "toolset": "host=x64"
    }
  },
  {
    "name": "Visual Studio Professional 2019 Release - amd64_x86",
    "visualStudio": "33a40df0",
    "visualStudioArchitecture": "x64",
    "preferredGenerator": {
      "name": "Visual Studio 16 2019",
      "platform": "win32",
      "toolset": "host=x64"
    }
  },
  {
    "name": "Visual Studio Professional 2019 Release - x86",
    "visualStudio": "33a40df0",
    "visualStudioArchitecture": "x86",
    "preferredGenerator": {
      "name": "Visual Studio 16 2019",
      "platform": "win32",
      "toolset": "host=x86"
    }
  },
  {
    "name": "Visual Studio Professional 2019 Release - x86_amd64",
    "visualStudio": "33a40df0",
    "visualStudioArchitecture": "x86",
    "preferredGenerator": {
      "name": "Visual Studio 16 2019",
      "platform": "x64",
      "toolset": "host=x86"
    }
  },
  {
    "name": "VisualStudio.10.0 - amd64",
    "visualStudio": "VisualStudio.10.0",
    "visualStudioArchitecture": "x64",
    "preferredGenerator": {
      "name": "Visual Studio 10 2010",
      "platform": "x64"
    }
  },
  {
    "name": "VisualStudio.10.0 - x86",
    "visualStudio": "VisualStudio.10.0",
    "visualStudioArchitecture": "x86",
    "preferredGenerator": {
      "name": "Visual Studio 10 2010",
      "platform": "win32"
    }
  },
  {
    "name": "VisualStudio.10.0 - x86_amd64",
    "visualStudio": "VisualStudio.10.0",
    "visualStudioArchitecture": "x86",
    "preferredGenerator": {
      "name": "Visual Studio 10 2010",
      "platform": "x64"
    }
  }
]

That is what I get after a CMake: Scan for kits. How do make the toolset appear for my visual studio 2010 kits or how do I prevent visual studio code from adding the options -T host=x64 -A x64 to the cmake command?

Originally posted by @zadigus in https://github.com/microsoft/vscode-cmake-tools/issues/1352#issuecomment-873842853

andreeis avatar Jul 07 '21 18:07 andreeis

If anyone is willing to test a simple VS version number change we would be interested in accepting a PR. In kit.ts, function tryCreateNewVCEnvironment, majorVersion may need to be 14 instead of 15.

According to CMake toolset keyword documentation, "toolset" should be supported starting with VS 2010.

andreeis avatar Jul 07 '21 18:07 andreeis

If anyone is willing to test a simple VS version number change we would be interested in accepting a PR. In kit.ts, function tryCreateNewVCEnvironment, majorVersion may need to be 14 instead of 15.

According to CMake toolset keyword documentation, "toolset" should be supported starting with VS 2010.

I have the same problem. Are there any plans to fix it? I'm ready to test the changes.

Tarisper avatar Nov 25 '21 16:11 Tarisper

In kit.ts, function tryCreateNewVCEnvironment, majorVersion may need to be 14 instead of 15. According to CMake toolset keyword documentation, "toolset" should be supported starting with VS 2010.

VS 2010 corresponds to version 10 according to the version table on Wikipedia. So shouldn't this be changed to 10 then?

chausner avatar May 14 '22 23:05 chausner