Change "cmake-kits.json" location
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
- "cmake-kits.json" in project/.vscode
- "cmake-kits.json" in workspace,
- "cmake-kits.json" in user profile
- "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
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 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.
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.
Implemented in recent PR.