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

Change "cmake-kits.json" location

Open KoeMai opened this issue 8 years ago • 4 comments

Brief Issue Summary

The kit approach is nice if you change the compiler on the same development environment. I have in my embedded projects different compiler with cross compilation. In most projects it is not possible to switch between all my installed compilers, because not all compilers support all language features. I would use the kit file to describe the possible compiler and build environments (PC or Target) of my project. This requires the possibility to make the kits project dependent.

Expected:

Way 1: Different order of kits search

  1. "cmake-kits.json" in project/.vscode
  2. "cmake-kits.json" in workspace,
  3. "cmake-kits.json" in user profile
  4. "cmake-kits.json" in system

Way 2: Define "cmake-kits.json" location by settings.json

Platform and Versions

  • Operating System: Windows, Linux
  • CMake Version: 3.9
  • VSCode Version: 1.19
  • Compiler/Toolchain: Visual C++ 2015, GCC 5.3, Clang

KoeMai avatar Jan 02 '18 17:01 KoeMai

I have another idea to make the kits project dependent. The settings file could have the following structure:

cmake-tools.kit : {
  [path: "default user profile | other paths with substitution for workspace root" |
  setting: { <kit description according to cmake-kits.json> }  ]
}

It should only be possible to have a path or a "setting" property, not both.

This approach allows the user to define their expected behavior for the kits. It allows to support different kit configuration

  • A system wide kit configuration if you have similar projects - A work-space wide kit configuration if you have different types of projects which do not support the same compilers (PC programming and embedded) - A project kit configuration if you have projects which require different compilers - It is possible to place the kit configuration to any location you like (e.g. tool-chain directory)

KoeMai avatar Jan 05 '18 08:01 KoeMai

@KoeMai I think a combination of both options would be best. Allow the user to define a path to the cmake-kits.json file OR define the kits directly in the project/user settings. If the user didn't provide any of these two, the first method will be used.

no-realm avatar Mar 01 '18 14:03 no-realm

I strongly lean toward not permitting the movement of the kits file, although I support the ability to have project-specific kits -- especially in cases where a project defines a toolchain file that it wishes to consume and distribute.

Absent a compelling use-case for being able to move the cmake-kits.json file arbitrarily, I want to put project-specific kits in .vscode/cmake-kits.json, and <datadir>/cmake-kits.json.

vector-of-bool avatar Mar 18 '18 06:03 vector-of-bool

Implemented in recent PR.

vector-of-bool avatar Mar 21 '18 04:03 vector-of-bool